atelierspierrot/service-container

View on GitHub

Showing 6 of 6 total issues

Function init has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function init(
        array $initial_services     = array(),
        array $services_providers   = array(),
        array $services_protected   = array()
    ) {
Severity: Minor
Found in src/ServiceContainer/ServiceContainer.php - About 2 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

Function unsetService has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    public function unsetService($name)
    {
        if ($this->hasService($name)) {
            if (!$this->isProtected($name)) {
                if ($this->hasProvider($name)) {
Severity: Minor
Found in src/ServiceContainer/ServiceContainer.php - About 1 hr 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

Function _constructService has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    protected function _constructService($name, array $arguments = array())
    {
        if ($this->hasProvider($name)) {
            $data = $this->getProvider($name);
            if (is_object($data) && CodeHelper::implementsInterface($data, 'ServiceContainer\ServiceProviderInterface')) {
Severity: Minor
Found in src/ServiceContainer/ServiceContainer.php - About 1 hr 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 _constructService has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    protected function _constructService($name, array $arguments = array())
    {
        if ($this->hasProvider($name)) {
            $data = $this->getProvider($name);
            if (is_object($data) && CodeHelper::implementsInterface($data, 'ServiceContainer\ServiceProviderInterface')) {
Severity: Minor
Found in src/ServiceContainer/ServiceContainer.php - About 1 hr to fix

    Function search has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            search: function(term) {
                // Create a new search index if needed
                if (!bhIndex) {
                    bhIndex = new Bloodhound({
                        limit: 500,
    Severity: Minor
    Found in phpdoc/sami.js - About 1 hr to fix

      Function loadClass has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          public function loadClass($className)
          {
              if ($filePath = $this->resolveFileName($className)) {
                  if ($this->getFailureFlag() & self::FAIL_GRACEFULLY) {
                      if ($this->classFileExists($filePath)) {
      Severity: Minor
      Found in src/SplClassLoader.php - About 35 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

      Severity
      Category
      Status
      Source
      Language