public function findMissingConstructorArgs()
    {
        try
        {
            $class = new ReflectionClass($this->getClassName());
        }
        catch (ReflectionException $e)
        {
            return $this;
        }

        if ($constructor = $class->getConstructor())
        {
            $finder = $this->getExecutableFinder();

            // Spin through all of the constructor parameters and for those that we can find the executable
            // path for we'll attempt to locate the executable. If we can't find the path then its more
            // then we'll ignore this filter as it will fail during the build.
            foreach ($constructor->getParameters() as $key => $parameter)
            {
                if ($this->hasArgumentAtPosition($key))
                {
                    continue;
                }

                $snakeParameter = $this->normalizeConstructorParameter($parameter->name);

                list($name, $suffix) = explode('_', $snakeParameter);

                // If the suffix is in the array of valid suffixes we can attempt to locate the parameter
                // first as an environment variable and secondly by recursively searching through our
                // paths defined in PATH. If we can't find it then ignore the filter.
                if (in_array($suffix, $this->validSuffixes))
                {
                    $path = $this->getEnvironmentVariable($snakeParameter) ?: $finder->find($name);

                    if ($path)
                    {
                        $this->setArgument($path, $key);
                    }
                    else
                    {
                        // There was a problem locating the path to the argument, we'll log that the
                        // filter was ignored here so that the developer can debug this better.
                        $this->log->error(sprintf('Failed to find required constructor argument for filter "%s". (%s)', $this->filter, $parameter));

                        $this->ignored = true;
                    }
                }
                elseif(str_is('nodePaths', $parameter->name))
                {
                    $this->setArgument($this->nodePaths, $key);
                }
            }
        }

        return $this;
    }
public function findMissingConstructorArgs()
    {
        try
        {
            $class = new ReflectionClass($this->getClassName());
        }
        catch (ReflectionException $e)
        {
            return $this;
        }

        if ($constructor = $class->getConstructor())
        {
            $finder = $this->getExecutableFinder();

            // Spin through all of the constructor parameters and for those that we can find the executable
            // path for we'll attempt to locate the executable. If we can't find the path then its more
            // then we'll ignore this filter as it will fail during the build.
            foreach ($constructor->getParameters() as $key => $parameter)
            {
                if ($this->hasArgumentAtPosition($key))
                {
                    continue;
                }

                $snakeParameter = $this->normalizeConstructorParameter($parameter->name);

                list($name, $suffix) = explode('_', $snakeParameter);

                // If the suffix is in the array of valid suffixes we can attempt to locate the parameter
                // first as an environment variable and secondly by recursively searching through our
                // paths defined in PATH. If we can't find it then ignore the filter.
                if (in_array($suffix, $this->validSuffixes))
                {
                    $path = $this->getEnvironmentVariable($snakeParameter) ?: $finder->find($name);

                    if ($path)
                    {
                        $this->setArgument($path, $key);
                    }
                    else
                    {
                        // There was a problem locating the path to the argument, we'll log that the
                        // filter was ignored here so that the developer can debug this better.
                        $this->log->error(sprintf('Failed to find required constructor argument for filter "%s". (%s)', $this->filter, $parameter));

                        $this->ignored = true;
                    }
                }
                elseif(str_is('nodePaths', $parameter->name))
                {
                    $this->setArgument($this->nodePaths, $key);
                }
            }
        }

        return $this;
    }
public function findMissingConstructorArgs ( ) { try { $ class = new ReflectionClass ( $ this -> getClassName ( ) ) ; } catch ( ReflectionException $ e ) { return $ this ; } if ( $ constructor = $ class -> getConstructor ( ) ) { $ finder = $ this -> getExecutableFinder ( ) ; // Spin through all of the constructor parameters and for those that we can find the executable // path for we'll attempt to locate the executable. If we can't find the path then its more // then we'll ignore this filter as it will fail during the build. foreach ( $ constructor -> getParameters ( ) as $ key => $ parameter ) { if ( $ this -> hasArgumentAtPosition ( $ key ) ) { continue ; } $ snakeParameter = $ this -> normalizeConstructorParameter ( $ parameter -> name ) ; list ( $ name , $ suffix ) = explode ( '_' , $ snakeParameter ) ; // If the suffix is in the array of valid suffixes we can attempt to locate the parameter // first as an environment variable and secondly by recursively searching through our // paths defined in PATH. If we can't find it then ignore the filter. if ( in_array ( $ suffix , $ this -> validSuffixes ) ) { $ path = $ this -> getEnvironmentVariable ( $ snakeParameter ) ? : $ finder -> find ( $ name ) ; if ( $ path ) { $ this -> setArgument ( $ path , $ key ) ; } else { // There was a problem locating the path to the argument, we'll log that the // filter was ignored here so that the developer can debug this better. $ this -> log -> error ( sprintf ( 'Failed to find required constructor argument for filter "%s". (%s)' , $ this -> filter , $ parameter ) ) ; $ this -> ignored = true ; } } elseif ( str_is ( 'nodePaths' , $ parameter -> name ) ) { $ this -> setArgument ( $ this -> nodePaths , $ key ) ; } } } return $ this ; }
Find and set any missing constructor arguments.

@return \Basset\Filter\Filter
Find and set any missing constructor arguments .