mambax7/alumni-26x

View on GitHub
class/plugin/good_search.php

Summary

Maintainability
A
2 hrs
Test Coverage

Method search has 50 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function search($queries, $andor, $limit, $start, $userid)
    {
        $xoops   = Xoops::getInstance();
        $alumni  = Alumni::getInstance();
        $myts    = MyTextSanitizer::getInstance();
Severity: Minor
Found in class/plugin/good_search.php - About 2 hrs to fix

    Method search has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public function search($queries, $andor, $limit, $start, $userid)
    Severity: Minor
    Found in class/plugin/good_search.php - About 35 mins to fix

      Missing class import via use statement (line '78', column '28').
      Open

              $criteria->add(new Criteria('year', '%' . $queries . '%', 'LIKE'), 'OR');
      Severity: Minor
      Found in class/plugin/good_search.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 '60', column '28').
      Open

              $criteria->add(new Criteria('cid', '(' . $all_ids . ')', 'IN'));
      Severity: Minor
      Found in class/plugin/good_search.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 '62', column '32').
      Open

                  $criteria->add(new Criteria('usid', $userid, '='));
      Severity: Minor
      Found in class/plugin/good_search.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 '74', column '28').
      Open

              $criteria->add(new Criteria('name', '%' . $queries . '%', 'LIKE'), 'AND');
      Severity: Minor
      Found in class/plugin/good_search.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 '75', column '28').
      Open

              $criteria->add(new Criteria('mname', '%' . $queries . '%', 'LIKE'), 'OR');
      Severity: Minor
      Found in class/plugin/good_search.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 '57', column '25').
      Open

              $criteria = new CriteriaCompo();
      Severity: Minor
      Found in class/plugin/good_search.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 '58', column '28').
      Open

              $criteria->add(new Criteria('valid', 1, '='));
      Severity: Minor
      Found in class/plugin/good_search.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 '77', column '28').
      Open

              $criteria->add(new Criteria('school', '%' . $queries . '%', 'LIKE'), 'OR');
      Severity: Minor
      Found in class/plugin/good_search.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 '28').
      Open

              $criteria->add(new Criteria('lname', '%' . $queries . '%', 'LIKE'), 'OR');
      Severity: Minor
      Found in class/plugin/good_search.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 '65', column '32').
      Open

                  $criteria->add(new Criteria('cid', $by_cat, '='));
      Severity: Minor
      Found in class/plugin/good_search.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 'Alumni' in method 'search'.
      Open

              $alumni  = Alumni::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 '\Xoops\Core\Request' in method 'search'.
      Open

              $andor   = Request::getWord('andor', 'AND');
      Severity: Minor
      Found in class/plugin/good_search.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 '\Xoops\Core\Request' in method 'search'.
      Open

              $start   = Request::getInt('start', '0');
      Severity: Minor
      Found in class/plugin/good_search.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 'Xoops' in method 'search'.
      Open

              $helper         = Xoops::getModuleHelper('alumni');
      Severity: Minor
      Found in class/plugin/good_search.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 '\Xoops\Core\Request' in method 'search'.
      Open

              $by_cat  = Request::getInt('by_cat', '');
      Severity: Minor
      Found in class/plugin/good_search.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 'Xoops' in method 'search'.
      Open

              $xoops   = Xoops::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 '\Xoops\Core\Request' in method 'search'.
      Open

              $query   = Request::getString('query', '');
      Severity: Minor
      Found in class/plugin/good_search.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 'MyTextSanitizer' in method 'search'.
      Open

              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 unused local variables such as '$alumni'.
      Open

              $alumni  = Alumni::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

      Avoid unused local variables such as '$numrows'.
      Open

              $numrows     = $listingHandler->getCount();
      Severity: Minor
      Found in class/plugin/good_search.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

      Avoid unused local variables such as '$myts'.
      Open

              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

      Avoid unused local variables such as '$count'.
      Open

              $count = 0;
      Severity: Minor
      Found in class/plugin/good_search.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

      Avoid unused local variables such as '$i'.
      Open

              $i     = 0;
      Severity: Minor
      Found in class/plugin/good_search.php by phpmd

      UnusedLocalVariable

      Since: 0.2

      Detects when a local variable is declared and/or assigned, but not used.

      Example

      class Foo {
          public function doSomething()
          {
              $i = 5; // Unused
          }
      }

      Source https://phpmd.org/rules/unusedcode.html#unusedlocalvariable

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

      class AlumniSearchPlugin extends PluginAbstract implements SearchPluginInterface
      Severity: Minor
      Found in class/plugin/good_search.php by phpcodesniffer

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

              $k   = 0;
      Severity: Minor
      Found in class/plugin/good_search.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

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

              $i     = 0;
      Severity: Minor
      Found in class/plugin/good_search.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

      Line exceeds 120 characters; contains 155 characters
      Open

                  $ret[$k]['title'] = $obj->getVar('name') . ' ' . $obj->getVar('mname') . ' ' . $obj->getVar('lname') . '   ---   ' . $obj->getVar('school') . '
      Severity: Minor
      Found in class/plugin/good_search.php by phpcodesniffer

      The variable $alumni_ids is not named in camelCase.
      Open

          public function search($queries, $andor, $limit, $start, $userid)
          {
              $xoops   = Xoops::getInstance();
              $alumni  = Alumni::getInstance();
              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 $module_id is not named in camelCase.
      Open

          public function search($queries, $andor, $limit, $start, $userid)
          {
              $xoops   = Xoops::getInstance();
              $alumni  = Alumni::getInstance();
              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 $this_search is not named in camelCase.
      Open

          public function search($queries, $andor, $limit, $start, $userid)
          {
              $xoops   = Xoops::getInstance();
              $alumni  = Alumni::getInstance();
              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 $by_cat is not named in camelCase.
      Open

          public function search($queries, $andor, $limit, $start, $userid)
          {
              $xoops   = Xoops::getInstance();
              $alumni  = Alumni::getInstance();
              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 $alumni_ids is not named in camelCase.
      Open

          public function search($queries, $andor, $limit, $start, $userid)
          {
              $xoops   = Xoops::getInstance();
              $alumni  = Alumni::getInstance();
              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 $module_id is not named in camelCase.
      Open

          public function search($queries, $andor, $limit, $start, $userid)
          {
              $xoops   = Xoops::getInstance();
              $alumni  = Alumni::getInstance();
              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 $by_cat is not named in camelCase.
      Open

          public function search($queries, $andor, $limit, $start, $userid)
          {
              $xoops   = Xoops::getInstance();
              $alumni  = Alumni::getInstance();
              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 $this_search is not named in camelCase.
      Open

          public function search($queries, $andor, $limit, $start, $userid)
          {
              $xoops   = Xoops::getInstance();
              $alumni  = Alumni::getInstance();
              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 $all_ids is not named in camelCase.
      Open

          public function search($queries, $andor, $limit, $start, $userid)
          {
              $xoops   = Xoops::getInstance();
              $alumni  = Alumni::getInstance();
              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 $all_ids is not named in camelCase.
      Open

          public function search($queries, $andor, $limit, $start, $userid)
          {
              $xoops   = Xoops::getInstance();
              $alumni  = Alumni::getInstance();
              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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 $by_cat is not named in camelCase.
      Open

          public function search($queries, $andor, $limit, $start, $userid)
          {
              $xoops   = Xoops::getInstance();
              $alumni  = Alumni::getInstance();
              $myts    = MyTextSanitizer::getInstance();
      Severity: Minor
      Found in class/plugin/good_search.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