Hijacks the class and reports the results of the next
method call

@param *object     $scope the class instance
@param string|null $name  the name of the property to inspect

@return InspectorInterface
976043
public function next($scope, string $name = null): InspectorInterface
    {
        $this->scope = $scope;
        $this->name = $name;

        return $this;
    }
1329645
public function _call($name, $arguments)
    {
        $object = $this->getObject();
    	try
    	{
			$method = new \ReflectionMethod($object, $name);
		} catch (\Exception $e)
		{
		    if (method_exists($object, '__call'))
		    {
		        return call_user_func_array(array($object, '__call'), (array) $arguments);
		    } else
		    {
                throw new \Exception('Unable to invoke method ' . $name . ' on object of class ' . get_class($object));
		    }
		    return null;
		}

		$method->setAccessible(true);
		return $method->invokeArgs($object, $arguments);
    }
62905
public static function scope($name, $conditions)
    {
        $cls = get_called_class();

        if (!array_key_exists($cls, self::$_scopes)) {
            self::$_scopes[$cls] = array();
        }

        if (!array_key_exists($name, self::$_scopes[$cls])) {
            self::$_scopes[$cls][$name] = array();
        }

        self::$_scopes[$cls][$name] = $conditions;
    }
74501
protected function purgeScope($scope)
    {
        foreach ($scope as $name => $obj) {
            if ($obj instanceof Generic) {
                if ($obj->source === 'config' && ($obj->revision < $this->revision)) {
                    if (!$obj->resetToDefault()) {
                        unset($scope->{$name});
                    }
                }
            } elseif ($obj instanceof Section) {
                if ($obj->source === 'config' && ($obj->revision < $this->revision)) {
                    if ($obj->count() === 0) {
                        unset($scope->{$name});
                    } elseif (isset($obj->enable)) {
                        $obj->enable->setValue(false);
                    }
                }
            }
        }
    }
347577
public function findFormControlByName(string $name): ?Control
  {
    foreach ($this->controls as $control)
    {
      if ($control->name===$name) return $control;

      if ($control instanceof ComplexControl)
      {
        $tmp = $control->findFormControlByName($name);
        if ($tmp) return $tmp;
      }
    }

    return null;
  }
1323011
private function createMethod(string $name): MethodInterface
    {
        $methodClass = $clientClass = null;

        foreach (['Postage', 'Tracking', 'Withdrawal'] as $ns) {
            $class = 'Ekyna\\Component\\Colissimo\\' . $ns . '\\Method\\' . ucwords($name) . 'Method';
            if (class_exists($class)) {
                $methodClass = $class;
                $clientClass = 'Ekyna\\Component\\Colissimo\\' . $ns . '\\Client';
                break;
            }
        }

        if (is_null($methodClass)) {
            throw new RuntimeException("Method {$name} does not exist");
        }

        return new $methodClass($this->factory->getClient($clientClass));
    }
1319625
public function directive(string $name, callable $handler): BladeInterface
    {
        $this
            ->getCompiler()
            ->directive($name, $handler);

        return $this;
    }
1089765
public function controller($controller_name)
    {
        // Retrieving the class and method to launch.
        if (is_null($controller_name)) {
            return null;
        }

        $parts = preg_split('/::|@/', $controller_name);

        if (count($parts) == 1) {
            $parts[1] = '__invoke';
        }

        list($class, $method) = $parts;

        if (!class_exists($class, true)) {
            $class = sprintf('%s\\%s', $this->namespaces['controller'], ucfirst($class));
        }

        $injections = $this->injector($class, $method);

        return [
            'action' => [new $class(), $method],
            'injection' => $injections
        ];
    }
850953
protected function makeFilterScope($name, $config)
    {
        $label = $config['label'] ?? null;
        $scopeType = $config['type'] ?? null;

        $scope = new FilterScope($name, $label);
        $scope->displayAs($scopeType, $config);

        /*
         * Set scope value
         */
        $scope->value = $this->getScopeValue($scope, @$config['default']);

        return $scope;
    }
292785
public function if(string $name, callable $handler): BladeInterface
    {
        if (!$this->conditionHandler) {
            $this->conditionHandler = new ConditionHandler();
            $this->share("_condition_handler", $this->conditionHandler);
        }

        $this->conditionHandler->add($name, $handler);

        $this->directive($name, function (string $expression) use ($name) {
            if ($expression === "") {
                $expression = "null";
            }
            return "<?php if (\$_condition_handler->check('{$name}', {$expression})): ?>";
        });

        $this->directive("end{$name}", function () {
            return "<?php endif; ?>";
        });

        return $this;
    }
691345
function getMethod($name) {
    if (isset($this->methods[$name])) {
      return $this->methods[$name];
    }
    if ($this->methodsComplete) {
      return NULL;
    }
    if (array_key_exists($name, $this->methodsNotFound)) {
      return NULL;
    }
    $methodObj = $this->findMethod($name);
    if (NULL === $methodObj) {
      $this->methodsNotFound[$name] = TRUE;
      return NULL;
    }
    $this->methods[$name] = $methodObj;
    return $methodObj;
  }
93809
public static function create($name, \PHPUnit_Framework_TestCase $phpunit)
    {
        $methods = array();

        $ref = new \ReflectionClass($name);
        foreach ($ref->getProperties() as $property) {
            $methods[] = 'get' . ucfirst($property->name);
            $methods[] = 'set' . ucfirst($property->name);
        }

        foreach ($ref->getMethods() as $method) {

            // do not mock array object methods to we can iterate these mocks
            if ($method->class === 'ArrayObject') {
                continue;
            }

            $methods[] = $method->name;
        }

        return $phpunit->getMockBuilder($name)
            ->disableOriginalConstructor()
            ->setMethods($methods)
            ->getMock();
    }
1038844
public function callInterceptor(string $name, ...$arguments)
    {
        if (!empty($this->interceptors[$name])) {
            foreach ($this->interceptors[$name] as $function) {
                $ret = Helper::call($function, ...$arguments);
                if ($ret !== null) {
                    return $ret;
                }
            }
        }

        return null;
    }
1034348
public function getInterface(string $name)
    {
        if ($this->hasInterface($name)) {
            return $this->interfaces[$name];
        }
        return null;
    }
824155
protected function _getter($name)
    {
    	// @codingStandardsIgnoreEnd
        $normalized = lcfirst($name);
        $property = "_{$normalized}";
        if (property_exists($this, $property)) {
            /** @var AnnotationsList $annotations */
            $annotations = $this->inspector->getPropertyAnnotations($property);

            if (
                !$annotations->hasAnnotation('@readwrite') &&
                !$annotations->hasAnnotation('@read')
            ) {
                $className = get_class($this);
                throw new Exception\WriteOnlyException(
                    "Trying to read the values of a write only property."
                    ." {$className}::\${$property} has annotation @write."
                );
            }
            return $this->$property;
        }
        return null;
    }
68865
public function getMethod($name)
    {
        $m = $this->getReflectionClass()->getMethod($name);
        return MethodInfo::__internal_create($this, $m);
    }
585971
function getScopeInfo($currScope, $autoCreate = true) {
        $scopeKey = $this->scopeKey($currScope);
        if (!isset($this->_scopes[$scopeKey])) {
            if (!$autoCreate) {
                return null;
            }
            $this->_scopes[$scopeKey] = new ScopeInfo($currScope);
        }
        return $this->_scopes[$scopeKey];
    }