{@inheritdoc}

@throws \ReflectionException
422247
public function bind(string $class, array $pointcuts) : BindInterface
    {
        $pointcuts = $this->getAnnotationPointcuts($pointcuts);
        $this->annotatedMethodsMatch(new \ReflectionClass($class), $pointcuts);

        return $this;
    }
954795
public function bind($key, $value)
    {
        if(is_callable($value)) {
            $this->aliases[$key] = $value;
        } elseif(is_object($value)) {
            $this->resolved[$key]  = $value;
        } else {
            if(class_exists($value)) $this->aliases[$key] =  $value;
            else throw new Exception("Class [ $value ] does not exist.");
        }
    }
325501
public function apply(object $object, ReflectionProperty $reflectionProperty, callable $objectCopier): void
    {
        $reflectionProperty->setAccessible(true);
        /** @var Collection $oldCollection */
        $oldCollection = $reflectionProperty->getValue($object);

        $newCollection = $oldCollection->map(
            function ($item) use ($objectCopier) {
                return $objectCopier($item);
            }
        );

        $reflectionProperty->setValue($object, $newCollection);
    }
567346
private function __reflection()
    {
        if (!$this->__reflection) {
            $this->__reflection = new \ReflectionClass(get_class($this));
        }
        return $this->__reflection;
    }
417665
public function bind()
    {
        parent::bind();

        // In environments that are not a skeleton app we use an Application
        // instance to hold the paths.
        if (!$this->app->bound(Application::class)) {
            $this->app->instance(Application::class, $this->createPlaceholderApp());
        }

        $this->assignPathsToApp($this->app->make(Application::class));

        $this->app->resolving(PathFinder::class, function ($paths) {
            $this->assignBaseAppPaths($paths);
        });

        $this->app->resolving(StringConverterChain::class, function ($chain) {
            $this->addStringConverters($chain);
        });

        $this->app->resolving(TextFormatter::class, function ($formatter, $app) {
            $formatter->setLocalizer($app('Ems\Contracts\Core\Localizer'));
        });

        $this->app->bind('ems::locale-config', function ($ioc) {

            /** @var Application $app */
            $app = $ioc(Application::class);
            $storage = new NestedFileStorage();
            $storage->setUrl($app->path('ems-resources')->append('lang'));
            $storage->setNestingLevel(1);

            $provider = new ArrayProvider();
            $provider->add($storage);

            return $provider;

        }, true);

        $this->app->bind(Matcher::class, function ($ioc) {
            return new Matcher($ioc(CheckerContract::class), $ioc(ExtractorContract::class));
        }, true);

        $this->app->resolving(Formatter::class, function (Formatter $formatter, $app) {
            $formatter->setFormats($app('ems::locale-config'));
        });

        $this->app->resolving(TextParserQueue::class, function ($queue, $app) {
            $queue->add($app(VariablesTextParser::class));
        });

        $this->app->resolving(AnythingProvider::class, function ($provider, $app) {
            $provider->createObjectsWith($app);
        });

        $this->app->resolving(SupportsCustomFactory::class, function ($object) {
            $object->createObjectsBy($this->app);
        });

        $this->app->resolving(HasInjectMethods::class, function (HasInjectMethods $object) {
            $this->autoInjectDependendies($object);
        });

        $this->app->resolving(ConnectionPoolContract::class, function (ConnectionPoolContract $pool) {
            /** @return void */
            $pool->extend('php', function (UrlContract $url) {
                if ($url->scheme == 'php' || $url->scheme == 'file') {
                    return new FilesystemConnection($url);
                }
                return null;
            });
        });
    }
267835
public function deserialize(string $json): WrapperInterface
    {
        try {
            /** @var WrapperInterface $wrapper */
            $wrapper = $this->jms()->deserialize(
                $json,
                $this->wrapperClass(),
                'json'
            );
        } catch (\Exception $e) {
            throw new \RuntimeException('Error while deserialize "' . $json . '"', 0, $e);
        }

        return $wrapper;
    }
79882
public function validate() {

		if ($this->getEndAction() === null) {
			throw new ValidationException("'endAction' can't be null", 'endAction', $this);
		}
		if ($this->getPlannedEndDate() === null) {
			throw new ValidationException("'plannedEndDate' can't be null", 'plannedEndDate', $this);
		}
		if ($this->getSubscription() === null) {
			throw new ValidationException("'subscription' can't be null", 'subscription', $this);
		}
	}
64029
public function load(): void
    {
        $refl = new \ReflectionClass(GeneralUtility::class);

        $this->loadClassNameCache($refl);
        $this->loadInstanceCache($refl);
    }
537537
public function getReflector()
    {
        if ($this->isFunction() || $this->isClosure()) {
            return new \ReflectionFunction($this->getCallable());
        }
        if ($this->isMethod()) {
            return new \ReflectionMethod($this->getClassName(), $this->getMethodName());
        }
        if ($this->isInvokedObject()) {
            return new \ReflectionMethod($this->getClassName(), '__invoke');
        }
        throw new \LogicException('Unknown callable reflection');
    }
8965
public function handle(\ReflectionParameter $parameter)
    {
        $func = $parameter->getDeclaringFunction();
        $method = new \ReflectionMethod($parameter->getDeclaringClass()->name, $func->name);
        $parameter->getDeclaringFunction()->name;
        $annotations = $this->reader->getMethodAnnotations($method);
        foreach ($annotations as $annotation) {
            if ($annotation instanceof ResourceParam && $annotation->param === $parameter->name) {
                return $this->getResourceParam($annotation->uri);
            }
        }
        (new VoidParamHandler)->handle($parameter);
    }
1193819
private function attemptInstantiationViaUnSerialization(ReflectionClass $reflectionClass, $serializedString)
    {
        set_error_handler(function ($code, $message, $file, $line) use ($reflectionClass, & $error) {
            $error = UnexpectedValueException::fromUncleanUnSerialization(
                $reflectionClass,
                $message,
                $code,
                $file,
                $line
            );
        });

        try {
            unserialize($serializedString);
        } catch (Exception $exception) {
            restore_error_handler();

            throw UnexpectedValueException::fromSerializationTriggeredException($reflectionClass, $exception);
        }

        restore_error_handler();

        if ($error) {
            throw $error;
        }
    }
173093
private function reflect()
    {
        $tokens = token_get_all($this->reflectedFileContent);
        $namespace = null;
        $classLevel = 0;
        $level = 0;
        $res = $uses = array();
        while (list(, $token) = each($tokens)) {
            switch (is_array($token) ? $token[0] : $token) {
                case T_CLASS:
                case T_INTERFACE:
                case T_TRAIT:
                    if ($name = $this->fetch($tokens, array(T_STRING))) {
                        $classLevel = $level + 1;
                        if ($namespace !== null) {
                            $objectFQN = $namespace . '\\' . $name;
                        } else {
                            $objectFQN = $name;
                        }
                        $this->objects[] = new ReflectionClass($objectFQN);
                    }
                    break;
                case T_NAMESPACE:
                    $namespace = '\\' . ltrim($this->fetch($tokens, array(T_STRING, T_NS_SEPARATOR)), '\\');
                    $res[$namespace] = array();
                    $uses = array();
                    break;
                case T_USE:
                    if ($classLevel === 0) {
                        while ($name = $this->fetch($tokens, array(T_STRING, T_NS_SEPARATOR))) {
                            $name = '\\' . ltrim($name, '\\');
                            if ($this->fetch($tokens, array(T_AS))) {
                                $uses[$this->fetch($tokens, array(T_STRING))] = $name;
                            } else {
                                $uses[$name] = $name;
                            }
                            if (!$this->fetch($tokens, array(','))) {
                                break;
                            }
                        }
                        $res[$namespace] = $uses;
                    }
                    break;
                case T_CURLY_OPEN:
                case T_DOLLAR_OPEN_CURLY_BRACES:
                case '{':
                    $level++;
                    break;
                case '}':
                    if ($level === $classLevel) {
                        $classLevel = 0;
                    }
                    $level--;
                    break;
            }
        }

        $this->namespaces = array_keys($res);
        $this->uses = $res;
    }
1366933
protected function execute(InputInterface $input, OutputInterface $output)
    {
        $inputs = array_merge($input->getArguments(), $input->getOptions());

        $parameters = array();

        //
        $reflection = new ReflectionFunction($this->callback);

        foreach ($reflection->getParameters() as $parameter) {
            if (isset($inputs[$parameter->name])) {
                $parameters[$parameter->name] = $inputs[$parameter->name];
            }
        }

        return $this->container->call(
            $this->callback->bindTo($this, $this), $parameters
        );
    }
1213082
protected function saveToCache()
    {
        if (!is_object($this->dataCache)) {
            throw new Exception('A cache must be injected before initializing the Reflection Service.', 1232044697);
        }
        $data = [];
        $propertyNames = [
            'reflectedClassNames',
            'classPropertyNames',
            'classMethodNames',
            'classTagsValues',
            'methodTagsValues',
            'methodParameters',
            'propertyTagsValues',
            'taggedClasses',
            'classSchemata'
        ];
        foreach ($propertyNames as $propertyName) {
            $data[$propertyName] = $this->{$propertyName};
        }
        $this->dataCache->set($this->cacheIdentifier, $data);
        $this->dataCacheNeedsUpdate = false;
    }
653017
public function main(){
        
        if(is_null($this->getDomain())){
            throw new \BuildException('the domain property is required');
        }

        if(is_null($this->getName())){
            throw new \BuildException('the name property is required');
        }

        if(is_null($this->getVersion())){
            throw new \BuildException('the version property is required');
        }

        if(is_null($this->getTasklist())){
            throw new \BuildException('the tasklist property is required');
        }

        try {
            $activity = $this->getService()->describeActivityType([
                'domain' => $this->getDomain(),
                'activityType' => [
                    'name' => $this->getName(),
                    'version' => $this->getVersion()
                ]
            ]);

            if ($activity->get('typeInfo')['status'] != 'REGISTERED') {
                throw new \BuildException('the activity "' . $this->getName() . '" is no more available');
            }

            $this->log('The activity "' . $this->getName() . '" already exists');
        } catch (SwfException $e) {
            $this->log('Creating "' . $this->getName() . '" v.' . $this->getVersion() . ' activity');

            $params = [
                'domain' => $this->getDomain(),
                'name' => $this->getName(),
                'version' => $this->getVersion(),
                'description' => $this->getDescription(),
                'defaultTaskStartToCloseTimeout' => $this->getStartToCloseTimeout() ?: 'NONE',
                'defaultTaskHeartbeatTimeout' => $this->getHeartbeatTimeout() ?: 'NONE',
                'defaultTaskScheduleToStartTimeout' => $this->getScheduleToStartTimeout() ?: 'NONE',
                'defaultTaskScheduleToCloseTimeout' => $this->getScheduleToCloseTimeout() ?: 'NONE',
                'defaultTaskList' => [
                    'name' => $this->getTasklist()
                ]
            ];

            $this->getService()->registerActivityType($params);

            $this->log('"' . $this->getName() . '" v.' . $this->getVersion() . ' activity successfully created');
        }
    }
1187970
public function process(\ReflectionProperty $property, TestCase $test)
    {
        /** @var \ReflectionProperty $property */
        $propertyDocComment = $property->getDocComment();
        if (preg_match(self::REGEX_MOCK, $propertyDocComment, $matches)) {
            $isPrivate = $property->isPrivate();
            if ($isPrivate) {
                $property->setAccessible(true);
            }
            $mock = $this->mockObjectFactory->create($matches[1]);
            $property->setValue($test, $mock);
            if ($isPrivate) {
                $property->setAccessible(false);
            }
        }
    }
32617
public function register(CommandInterface $command)
    {
        /*
         * Gets the name of the command
         * @var string
         */
        $name = $command->getCommand();

        /*
         * Check if the command isn't already registered
         * otherwise throw an exception
         */
        if (array_key_exists($name, $this->commands)) {
            throw new CommandException("Command with name '$name' already registered");
        }

        /*
         * Adds the command to the array
         */
        $this->commands[$name] = $command;
    }