src/Shop/Views/ServiceMetafield.php

Summary

Maintainability
F
6 days
Test Coverage

Function get has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

    public static function get($request, $match)
    {
        // Check if service exsit
        $item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
        // Extract metafield id or metafield key if id is not provided
Severity: Minor
Found in src/Shop/Views/ServiceMetafield.php - About 3 hrs to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Method find has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public static function find($request, $match)
    {
        $item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
        $paginator = new Pluf_Paginator(Pluf::factory('Shop_ServiceMetafield'));
        $sql = new Pluf_SQL('service_id=%s', array(
Severity: Minor
Found in src/Shop/Views/ServiceMetafield.php - About 1 hr to fix

    Method get has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function get($request, $match)
        {
            // Check if service exsit
            $item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
            // Extract metafield id or metafield key if id is not provided
    Severity: Minor
    Found in src/Shop/Views/ServiceMetafield.php - About 1 hr to fix

      Function getMetafieldByIdOrKey has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          private static function getMetafieldByIdOrKey($request, $match){
              $mfId = null;
              // Extract metafield id (if exist)
              if (isset($match['id'])) {
                  $mfId = $match['id'];
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php - About 45 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      The method get() has a Cyclomatic Complexity of 11. The configured cyclomatic complexity threshold is 10.
      Open

          public static function get($request, $match)
          {
              // Check if service exsit
              $item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
              // Extract metafield id or metafield key if id is not provided
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      CyclomaticComplexity

      Since: 0.1

      Complexity is determined by the number of decision points in a method plus one for the method entry. The decision points are 'if', 'while', 'for', and 'case labels'. Generally, 1-4 is low complexity, 5-7 indicates moderate complexity, 8-10 is high complexity, and 11+ is very high complexity.

      Example

      // Cyclomatic Complexity = 11
      class Foo {
      1   public function example() {
      2       if ($a == $b) {
      3           if ($a1 == $b1) {
                      fiddle();
      4           } elseif ($a2 == $b2) {
                      fiddle();
                  } else {
                      fiddle();
                  }
      5       } elseif ($c == $d) {
      6           while ($c == $d) {
                      fiddle();
                  }
      7        } elseif ($e == $f) {
      8           for ($n = 0; $n < $h; $n++) {
                      fiddle();
                  }
              } else {
                  switch ($z) {
      9               case 1:
                          fiddle();
                          break;
      10              case 2:
                          fiddle();
                          break;
      11              case 3:
                          fiddle();
                          break;
                      default:
                          fiddle();
                          break;
                  }
              }
          }
      }

      Source https://phpmd.org/rules/codesize.html#cyclomaticcomplexity

      Missing class import via use statement (line '10', column '26').
      Open

              $paginator = new Pluf_Paginator(Pluf::factory('Shop_ServiceMetafield'));
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '11', column '20').
      Open

              $sql = new Pluf_SQL('service_id=%s', array(
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '69', column '23').
      Open

                  throw new Pluf_Exception_BadRequest('Neither Id nor key of metafield is provided.');
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '79', column '24').
      Open

                  $sql = new Pluf_SQL('`key`=%s AND `service_id`=%d', array($mfKey, $item->id));
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '76', column '27').
      Open

                      throw new Pluf_Exception_DoesNotExist('Metafield with id (' . $metafield->id . ') is not blong to the Service with id (' . $item->id . ')');
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '83', column '23').
      Open

                  throw new Pluf_Exception_DoesNotExist('There is no such Metafield');
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '135', column '27').
      Open

                      throw new Pluf_Exception_DoesNotExist('Metafield with id (' . $metafield->id . ') is not blong to the Service with id (' . $match['modelId'] . ')');
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Missing class import via use statement (line '138', column '24').
      Open

                  $sql = new Pluf_SQL('`key`=%s AND `service_id`=%s', array($request->REQUEST['key'], $match['modelId']));
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      MissingImport

      Since: 2.7.0

      Importing all external classes in a file through use statements makes them clearly visible.

      Example

      function make() {
          return new \stdClass();
      }

      Source http://phpmd.org/rules/cleancode.html#MissingImport

      Avoid using static access to class 'Pluf' in method 'find'.
      Open

              $paginator = new Pluf_Paginator(Pluf::factory('Shop_ServiceMetafield'));
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      The method getMetafieldByIdOrKey uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              }else{
                  $sql = new Pluf_SQL('`key`=%s AND `service_id`=%s', array($request->REQUEST['key'], $match['modelId']));
                  $str = $sql->gen();
                  $metafield = Pluf::factory('Shop_ServiceMetafield')->getOne($str);
              }
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      The method remove uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them.
      Open

              } else {
                  $mfId = $request->REQUEST['id'];
              }
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      ElseExpression

      Since: 1.4.0

      An if expression with an else branch is basically not necessary. You can rewrite the conditions in a way that the else clause is not necessary and the code becomes simpler to read. To achieve this, use early return statements, though you may need to split the code it several smaller methods. For very simple assignments you could also use the ternary operations.

      Example

      class Foo
      {
          public function bar($flag)
          {
              if ($flag) {
                  // one branch
              } else {
                  // another branch
              }
          }
      }

      Source https://phpmd.org/rules/cleancode.html#elseexpression

      Avoid using static access to class 'Pluf' in method 'createOrUpdate'.
      Open

                  $metafield = Pluf::factory('Shop_ServiceMetafield');
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Avoid using static access to class 'Shop_Views_ServiceMetafield' in method 'createOrUpdate'.
      Open

              $metafield = Shop_Views_ServiceMetafield::getMetafieldByIdOrKey($request, $match);
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      StaticAccess

      Since: 1.4.0

      Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

      Example

      class Foo
      {
          public function bar()
          {
              Bar::baz();
          }
      }

      Source https://phpmd.org/rules/cleancode.html#staticaccess

      Define a constant instead of duplicating this literal "modelId" 6 times.
      Open

              $item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
      Severity: Critical
      Found in src/Shop/Views/ServiceMetafield.php by sonar-php

      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

      Noncompliant Code Example

      With the default threshold of 3:

      function run() {
        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
        execute('action1');
        release('action1');
      }
      

      Compliant Solution

      ACTION_1 = 'action1';
      
      function run() {
        prepare(ACTION_1);
        execute(ACTION_1);
        release(ACTION_1);
      }
      

      Exceptions

      To prevent generating some false-positives, literals having less than 5 characters are excluded.

      Define a constant instead of duplicating this literal "namespace" 3 times.
      Open

                  'namespace',
      Severity: Critical
      Found in src/Shop/Views/ServiceMetafield.php by sonar-php

      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

      Noncompliant Code Example

      With the default threshold of 3:

      function run() {
        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
        execute('action1');
        release('action1');
      }
      

      Compliant Solution

      ACTION_1 = 'action1';
      
      function run() {
        prepare(ACTION_1);
        execute(ACTION_1);
        release(ACTION_1);
      }
      

      Exceptions

      To prevent generating some false-positives, literals having less than 5 characters are excluded.

      Define a constant instead of duplicating this literal "metafield" 4 times.
      Open

              } else if(isset($request->REQUEST['metafield'])){
      Severity: Critical
      Found in src/Shop/Views/ServiceMetafield.php by sonar-php

      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

      Noncompliant Code Example

      With the default threshold of 3:

      function run() {
        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
        execute('action1');
        release('action1');
      }
      

      Compliant Solution

      ACTION_1 = 'action1';
      
      function run() {
        prepare(ACTION_1);
        execute(ACTION_1);
        release(ACTION_1);
      }
      

      Exceptions

      To prevent generating some false-positives, literals having less than 5 characters are excluded.

      Define a constant instead of duplicating this literal "value" 3 times.
      Open

                  'value',
      Severity: Critical
      Found in src/Shop/Views/ServiceMetafield.php by sonar-php

      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

      Noncompliant Code Example

      With the default threshold of 3:

      function run() {
        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
        execute('action1');
        release('action1');
      }
      

      Compliant Solution

      ACTION_1 = 'action1';
      
      function run() {
        prepare(ACTION_1);
        execute(ACTION_1);
        release(ACTION_1);
      }
      

      Exceptions

      To prevent generating some false-positives, literals having less than 5 characters are excluded.

      Remove this commented out code.
      Open

      //     {

      Programmers should not comment out code as it bloats programs and reduces readability.

      Unused code should be deleted and can be retrieved from source control history if required.

      See

      • MISRA C:2004, 2.4 - Sections of code should not be "commented out".
      • MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
      • MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
      • MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"

      Define a constant instead of duplicating this literal "Shop_Service" 3 times.
      Open

              $item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
      Severity: Critical
      Found in src/Shop/Views/ServiceMetafield.php by sonar-php

      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

      Noncompliant Code Example

      With the default threshold of 3:

      function run() {
        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
        execute('action1');
        release('action1');
      }
      

      Compliant Solution

      ACTION_1 = 'action1';
      
      function run() {
        prepare(ACTION_1);
        execute(ACTION_1);
        release(ACTION_1);
      }
      

      Exceptions

      To prevent generating some false-positives, literals having less than 5 characters are excluded.

      Define a constant instead of duplicating this literal "Shop_ServiceMetafield" 7 times.
      Open

              $paginator = new Pluf_Paginator(Pluf::factory('Shop_ServiceMetafield'));
      Severity: Critical
      Found in src/Shop/Views/ServiceMetafield.php by sonar-php

      Duplicated string literals make the process of refactoring error-prone, since you must be sure to update all occurrences.

      On the other hand, constants can be referenced from many places, but only need to be updated in a single place.

      Noncompliant Code Example

      With the default threshold of 3:

      function run() {
        prepare('action1');                              // Non-Compliant - 'action1' is duplicated 3 times
        execute('action1');
        release('action1');
      }
      

      Compliant Solution

      ACTION_1 = 'action1';
      
      function run() {
        prepare(ACTION_1);
        execute(ACTION_1);
        release(ACTION_1);
      }
      

      Exceptions

      To prevent generating some false-positives, literals having less than 5 characters are excluded.

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      <?php
      Pluf::loadFunction('Pluf_Shortcuts_GetObjectOr404');
      Pluf::loadFunction('Shop_Shortcuts_NormalizeItemPerPage');
      
      class Shop_Views_ServiceMetafield
      Severity: Major
      Found in src/Shop/Views/ServiceMetafield.php and 1 other location - About 5 days to fix
      src/Shop/Views/ProductMetafield.php on lines 1..145

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 981.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Each class must be in a namespace of at least one level (a top-level vendor name)
      Open

      class Shop_Views_ServiceMetafield

      A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 5 and the first side effect is on line 2.
      Open

      <?php

      The class Shop_Views_ServiceMetafield is not named in CamelCase.
      Open

      class Shop_Views_ServiceMetafield
      {
          public static function find($request, $match)
          {
              $item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      CamelCaseClassName

      Since: 0.2

      It is considered best practice to use the CamelCase notation to name classes.

      Example

      class class_name {
      }

      Source

      Avoid variables with short names like $mf. Configured minimum length is 3.
      Open

              $mf = Pluf_Shortcuts_GetObjectOr404('Shop_ServiceMetafield', $mfId);
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      ShortVariable

      Since: 0.2

      Detects when a field, local, or parameter has a very short name.

      Example

      class Something {
          private $q = 15; // VIOLATION - Field
          public static function main( array $as ) { // VIOLATION - Formal
              $r = 20 + $this->q; // VIOLATION - Local
              for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
                  $r += $this->q;
              }
          }
      }

      Source https://phpmd.org/rules/naming.html#shortvariable

      The closing brace for the class must go on the next line after the body
      Open

      }

      Line exceeds 120 characters; contains 164 characters
      Open

                      throw new Pluf_Exception_DoesNotExist('Metafield with id (' . $metafield->id . ') is not blong to the Service with id (' . $match['modelId'] . ')');

      Line exceeds 120 characters; contains 134 characters
      Open

           * @throws Pluf_Exception_DoesNotExist if Id is given and Metafield with given id does not exist or is not blong to given Service 

      Line exceeds 120 characters; contains 156 characters
      Open

                      throw new Pluf_Exception_DoesNotExist('Metafield with id (' . $metafield->id . ') is not blong to the Service with id (' . $item->id . ')');

      Usage of ELSE IF is discouraged; use ELSEIF instead
      Open

              } else if(isset($request->REQUEST['metafield'])){

      Expected 1 space after closing parenthesis; found 0
      Open

              if(!isset($mfId) && !isset($mfKey)){

      Expected 1 space after IF keyword; 0 found
      Open

              if(isset($mfId)){

      Expected 1 space after IF keyword; 0 found
      Open

              } else if(isset($request->REQUEST['metafield'])){

      Usage of ELSE IF is discouraged; use ELSEIF instead
      Open

              } else if(isset($match['mfKey'])){

      Expected 1 space after closing parenthesis; found 0
      Open

              } else if(isset($request->REQUEST['key'])){

      Whitespace found at end of line
      Open

           * @throws Pluf_Exception_DoesNotExist if Id is given and Metafield with given id does not exist or is not blong to given Service 

      Class name "Shop_Views_ServiceMetafield" is not in camel caps format
      Open

      class Shop_Views_ServiceMetafield

      Expected 1 space after ELSE keyword; 0 found
      Open

              }else{

      Expected 1 space after closing brace; 0 found
      Open

              }else{

      Expected 1 space after closing brace; 0 found
      Open

              }else if(isset($mfKey)){

      Expected 1 space after closing parenthesis; found 0
      Open

              if(!isset($metafield)){

      Expected 1 space after IF keyword; 0 found
      Open

              if(isset($mfId)){

      Expected 1 space after closing parenthesis; found 0
      Open

              if(isset($mfId)){

      Expected 1 space after closing parenthesis; found 0
      Open

              } else if(isset($request->REQUEST['metafield'])){

      Expected 1 space after IF keyword; 0 found
      Open

              } else if(isset($match['mfKey'])){

      Expected 1 space after IF keyword; 0 found
      Open

              }else if(isset($mfKey)){

      Whitespace found at end of line
      Open

                  $mfKey = $match['mfKey'];            

      Expected 1 space after closing parenthesis; found 0
      Open

              }else if(isset($mfKey)){

      Expected 1 space after IF keyword; 0 found
      Open

              if(!isset($metafield)){ // Should be created

      Expected 1 space after IF keyword; 0 found
      Open

              if(!isset($mfId) && !isset($mfKey)){

      Expected 1 space after closing parenthesis; found 0
      Open

              if(isset($mfId)){

      Usage of ELSE IF is discouraged; use ELSEIF instead
      Open

              } else if(isset($request->REQUEST['metafield'])){

      Expected 1 space after closing parenthesis; found 0
      Open

              } else if(isset($match['mfKey'])){

      Expected 1 space after closing parenthesis; found 0
      Open

              if(!isset($metafield)){ // Should be created

      Expected 1 space after IF keyword; 0 found
      Open

              } else if(isset($request->REQUEST['metafield'])){

      Usage of ELSE IF is discouraged; use ELSEIF instead
      Open

              } else if(isset($request->REQUEST['key'])){

      Usage of ELSE IF is discouraged; use ELSEIF instead
      Open

              }else if(isset($mfKey)){

      Opening brace should be on a new line
      Open

          private static function getMetafieldByIdOrKey($request, $match){

      Expected 1 space after IF keyword; 0 found
      Open

              } else if(isset($request->REQUEST['key'])){

      Expected 1 space after IF keyword; 0 found
      Open

              if(!isset($metafield)){

      Expected 1 space after closing parenthesis; found 0
      Open

              } else if(isset($request->REQUEST['metafield'])){

      The variable $sort_fields is not named in camelCase.
      Open

          public static function find($request, $match)
          {
              $item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
              $paginator = new Pluf_Paginator(Pluf::factory('Shop_ServiceMetafield'));
              $sql = new Pluf_SQL('service_id=%s', array(
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $search_fields is not named in camelCase.
      Open

          public static function find($request, $match)
          {
              $item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
              $paginator = new Pluf_Paginator(Pluf::factory('Shop_ServiceMetafield'));
              $sql = new Pluf_SQL('service_id=%s', array(
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $search_fields is not named in camelCase.
      Open

          public static function find($request, $match)
          {
              $item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
              $paginator = new Pluf_Paginator(Pluf::factory('Shop_ServiceMetafield'));
              $sql = new Pluf_SQL('service_id=%s', array(
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      The variable $sort_fields is not named in camelCase.
      Open

          public static function find($request, $match)
          {
              $item = Pluf_Shortcuts_GetObjectOr404('Shop_Service', $match['modelId']);
              $paginator = new Pluf_Paginator(Pluf::factory('Shop_ServiceMetafield'));
              $sql = new Pluf_SQL('service_id=%s', array(
      Severity: Minor
      Found in src/Shop/Views/ServiceMetafield.php by phpmd

      CamelCaseVariableName

      Since: 0.2

      It is considered best practice to use the camelCase notation to name variables.

      Example

      class ClassName {
          public function doSomething() {
              $data_module = new DataModule();
          }
      }

      Source

      There are no issues that match your filters.

      Category
      Status