private function extractParameters(callable $callable, ChefInterface $chef, array &$workPlan): array
    {
        $values = [];
        foreach ($this->getParametersInOrder($callable) as $name => $parameter) {
            $class = $parameter->getClass();

            if ($class instanceof \ReflectionClass && $class->isInstance($chef)) {
                $values[] = $chef;
                continue;
            }

            if (!empty($this->mapping[$name])) {
                $name = $this->mapping[$name];
            }

            if (isset($workPlan[$name])) {
                $values[] = $workPlan[$name];
                continue;
            }

            if ($class instanceof \ReflectionClass) {
                $automaticValueFound = $this->findInstanceForParameter($class, $workPlan, $values);

                if (true === $automaticValueFound) {
                    continue;
                }
            }

            if (BowlInterface::METHOD_NAME === $name) {
                $values[] = $this->name;
                continue;
            }

            if (!$parameter->isOptional()) {
                throw new \RuntimeException("Missing the parameter {$parameter->getName()} in the WorkPlan");
            }

            $values[] = $parameter->getDefaultValue();
        }

        return $values;
    }
private function extractParameters(callable $callable, ChefInterface $chef, array &$workPlan): array
    {
        $values = [];
        foreach ($this->getParametersInOrder($callable) as $name => $parameter) {
            $class = $parameter->getClass();

            if ($class instanceof \ReflectionClass && $class->isInstance($chef)) {
                $values[] = $chef;
                continue;
            }

            if (!empty($this->mapping[$name])) {
                $name = $this->mapping[$name];
            }

            if (isset($workPlan[$name])) {
                $values[] = $workPlan[$name];
                continue;
            }

            if ($class instanceof \ReflectionClass) {
                $automaticValueFound = $this->findInstanceForParameter($class, $workPlan, $values);

                if (true === $automaticValueFound) {
                    continue;
                }
            }

            if (BowlInterface::METHOD_NAME === $name) {
                $values[] = $this->name;
                continue;
            }

            if (!$parameter->isOptional()) {
                throw new \RuntimeException("Missing the parameter {$parameter->getName()} in the WorkPlan");
            }

            $values[] = $parameter->getDefaultValue();
        }

        return $values;
    }
private function extractParameters ( callable $ callable , ChefInterface $ chef , array & $ workPlan ) : array { $ values = [ ] ; foreach ( $ this -> getParametersInOrder ( $ callable ) as $ name => $ parameter ) { $ class = $ parameter -> getClass ( ) ; if ( $ class instanceof \ ReflectionClass && $ class -> isInstance ( $ chef ) ) { $ values [ ] = $ chef ; continue ; } if ( ! empty ( $ this -> mapping [ $ name ] ) ) { $ name = $ this -> mapping [ $ name ] ; } if ( isset ( $ workPlan [ $ name ] ) ) { $ values [ ] = $ workPlan [ $ name ] ; continue ; } if ( $ class instanceof \ ReflectionClass ) { $ automaticValueFound = $ this -> findInstanceForParameter ( $ class , $ workPlan , $ values ) ; if ( true === $ automaticValueFound ) { continue ; } } if ( BowlInterface :: METHOD_NAME === $ name ) { $ values [ ] = $ this -> name ; continue ; } if ( ! $ parameter -> isOptional ( ) ) { throw new \ RuntimeException ( "Missing the parameter {$parameter->getName()} in the WorkPlan" ) ; } $ values [ ] = $ parameter -> getDefaultValue ( ) ; } return $ values ; }
To map each callable's arguments to ingredients available into the workplan.

@param callable $callable
@param ChefInterface $chef
@param array $workPlan

@return array

@throws \Exception
@SuppressWarnings(PHPMD.CyclomaticComplexity)
To map each callable s arguments to ingredients available into the workplan .