chroma-x/php-url-util

View on GitHub

Showing 25 of 25 total issues

Url has 36 functions (exceeds 20 allowed). Consider refactoring.
Open

class Url implements UrlInterface
{

    /**
     * @var string
Severity: Minor
Found in src/Url.php - About 4 hrs to fix

    The class Url has an overall complexity of 92 which is very high. The configured complexity threshold is 50.
    Open

    class Url implements UrlInterface
    {
    
        /**
         * @var string
    Severity: Minor
    Found in src/Url.php by phpmd

    File Url.php has 301 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    namespace ChromaX\UrlUtil;
    
    /**
    Severity: Minor
    Found in src/Url.php - About 3 hrs to fix

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

          public function setUsername($username)
          {
              if (!is_null($username) && !is_string($username)) {
                  $argumentType = (is_object($username)) ? get_class($username) : gettype($username);
                  throw new \InvalidArgumentException('Expected username as string; got ' . $argumentType);
      Severity: Major
      Found in src/Url.php and 5 other locations - About 45 mins to fix
      src/Url.php on lines 162..170
      src/Url.php on lines 192..200
      src/Url.php on lines 222..230
      src/Url.php on lines 462..470
      src/Url.php on lines 492..500

      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 95.

      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

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

          public function setScheme($scheme)
          {
              if (!is_null($scheme) && !is_string($scheme)) {
                  $argumentType = (is_object($scheme)) ? get_class($scheme) : gettype($scheme);
                  throw new \InvalidArgumentException('Expected scheme as string; got ' . $argumentType);
      Severity: Major
      Found in src/Url.php and 5 other locations - About 45 mins to fix
      src/Url.php on lines 192..200
      src/Url.php on lines 222..230
      src/Url.php on lines 432..440
      src/Url.php on lines 462..470
      src/Url.php on lines 492..500

      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 95.

      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

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

          public function setFragment($fragment)
          {
              if (!is_null($fragment) && !is_string($fragment)) {
                  $argumentType = (is_object($fragment)) ? get_class($fragment) : gettype($fragment);
                  throw new \InvalidArgumentException('Expected fragment as string; got ' . $argumentType);
      Severity: Major
      Found in src/Url.php and 5 other locations - About 45 mins to fix
      src/Url.php on lines 162..170
      src/Url.php on lines 192..200
      src/Url.php on lines 222..230
      src/Url.php on lines 432..440
      src/Url.php on lines 462..470

      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 95.

      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

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

          public function setPassword($password)
          {
              if (!is_null($password) && !is_string($password)) {
                  $argumentType = (is_object($password)) ? get_class($password) : gettype($password);
                  throw new \InvalidArgumentException('Expected password as string; got ' . $argumentType);
      Severity: Major
      Found in src/Url.php and 5 other locations - About 45 mins to fix
      src/Url.php on lines 162..170
      src/Url.php on lines 192..200
      src/Url.php on lines 222..230
      src/Url.php on lines 432..440
      src/Url.php on lines 492..500

      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 95.

      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

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

          public function setHostname($hostname)
          {
              if (!is_null($hostname) && !is_string($hostname)) {
                  $argumentType = (is_object($hostname)) ? get_class($hostname) : gettype($hostname);
                  throw new \InvalidArgumentException('Expected hostname as string; got ' . $argumentType);
      Severity: Major
      Found in src/Url.php and 5 other locations - About 45 mins to fix
      src/Url.php on lines 162..170
      src/Url.php on lines 222..230
      src/Url.php on lines 432..440
      src/Url.php on lines 462..470
      src/Url.php on lines 492..500

      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 95.

      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

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

          public function setPort($port)
          {
              if (!is_null($port) && !is_int($port)) {
                  $argumentType = (is_object($port)) ? get_class($port) : gettype($port);
                  throw new \InvalidArgumentException('Expected port as integer; got ' . $argumentType);
      Severity: Major
      Found in src/Url.php and 5 other locations - About 45 mins to fix
      src/Url.php on lines 162..170
      src/Url.php on lines 192..200
      src/Url.php on lines 432..440
      src/Url.php on lines 462..470
      src/Url.php on lines 492..500

      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 95.

      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

      Missing class import via use statement (line '82', column '14').
      Open

                  throw new \InvalidArgumentException('Expected query parameter value as scalar; got ' . $argumentType);
      Severity: Minor
      Found in src/QueryParameter.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 '294', column '14').
      Open

                  throw new \InvalidArgumentException('Expected query parameters as array; got ' . $argumentType);
      Severity: Minor
      Found in src/Url.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 '496', column '14').
      Open

                  throw new \InvalidArgumentException('Expected fragment as string; got ' . $argumentType);
      Severity: Minor
      Found in src/Url.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 '466', column '14').
      Open

                  throw new \InvalidArgumentException('Expected password as string; got ' . $argumentType);
      Severity: Minor
      Found in src/Url.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 '299', column '15').
      Open

                      throw new \InvalidArgumentException('Expected query parameters as array of QueryParameterInterface implementations; found ' . $argumentType);
      Severity: Minor
      Found in src/Url.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 '71', column '14').
      Open

                  throw new \InvalidArgumentException('Expected URL as string; got ' . $argumentType);
      Severity: Minor
      Found in src/Url.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 '52', column '14').
      Open

                  throw new \InvalidArgumentException('Expected query parameter names as string; got ' . $argumentType);
      Severity: Minor
      Found in src/QueryParameter.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 '319', column '15').
      Open

                      throw new \InvalidArgumentException('Expected query parameter values as scalar; found ' . $argumentType);
      Severity: Minor
      Found in src/Url.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 '196', column '14').
      Open

                  throw new \InvalidArgumentException('Expected hostname as string; got ' . $argumentType);
      Severity: Minor
      Found in src/Url.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 '392', column '14').
      Open

                  throw new \InvalidArgumentException('Expected query parameter key as string; got ' . $argumentType);
      Severity: Minor
      Found in src/Url.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 '314', column '14').
      Open

                  throw new \InvalidArgumentException('Expected query parameters as array; got ' . $argumentType);
      Severity: Minor
      Found in src/Url.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

      Severity
      Category
      Status
      Source
      Language