Returns the required configuration parameters of the task.

@param string $taskClass

@return array
14523
private function getTaskConfigurationParameters($taskClass)
    {
        $parameters = array();

        $reflectionClass = new ReflectionClass($taskClass);
        $reflectionConstructorMethod = $reflectionClass->getConstructor();
        if ($reflectionConstructorMethod instanceof ReflectionMethod) {
            foreach ($reflectionConstructorMethod->getParameters() as $reflectionParameter) {
                if ($reflectionParameter instanceof ReflectionParameter && $reflectionParameter->isDefaultValueAvailable() === false) {
                    $parameterValue = '';
                    if ($reflectionParameter->isArray()) {
                        $parameterValue = array();
                    }

                    $parameters[$reflectionParameter->getName()] = $parameterValue;
                }
            }
        }

        return $parameters;
    }
1020445
protected function getModelColumns($class)
    {
        $attributes = [];

        $classNamespace = $this->getModelNamespace($class);

        if ($class) {
            if (class_exists($classNamespace)) {
                $model = new \ReflectionClass($classNamespace);

                if ($model->isSubclassOf('Illuminate\Database\Eloquent\Model')) {
                    $mdl = $this->app->make($classNamespace);
                    $table = $mdl->getTable();

                    if (is_array($table)) {
                        $table = array_first($table);
                    }

                    $table = $mdl->getConnection()->getTablePrefix().$table;
                    $schema = $mdl->getConnection()->getDoctrineSchemaManager($table);

                    $database = null;
                    if (strpos($table, '.')) {
                        list($database, $table) = explode('.', $table);
                    }

                    $columns = Arr::except($schema->listTableColumns($table, $database), $mdl->getHidden());

                    foreach ($columns as $column) {
                        if ($column->getType() instanceof \Doctrine\DBAL\Types\JsonArrayType) {
                            continue;
                        }

                        $castTo = $this->getCasting($column->getType());

                        $attributes[] = ['column' => $column->getName(), 'casts' => $castTo];
                    }

                    return $attributes;
                }
            } else {
                $this->error("Your model {$class} was not found in {$this->config->get('fractal.model_namespace')}\\ \r\nIf this is the first time you get this message, try to update /config/fractal.php to make changes to model_namespace accordingly.");
                exit();
            }
        }

        // use as a default attribute
        return [
            ['column' => 'id', 'casts' => null],
        ];
    }
832346
protected function getParameters()
    {
        // 1. load from boilerplate
        // 2. load from environment
        // 3. load from $this->parameters
        $boilerplateParameters = $this->readFromBoilerplate();

        $environmentParameters = $this->tryToLoadFromEnvironment($this->loadFromEnvironment);
        $missingInEnvironment = array_diff($this->loadFromEnvironment, array_keys($environmentParameters));

        if ($missingInEnvironment && $this->failOnMissingEnvVariables) {
            throw new TaskException(
                $this,
                'Some parameters could not be found via environment: '
                . implode(', ', $this->getEnvName($missingInEnvironment))
            );
        }

        return array_replace_recursive($boilerplateParameters, $environmentParameters, $this->parameters);
    }
382612
private function getClassConsts($class)
    {
        $result = '';
        foreach($class->getConstants() as $name => $value)
        {
            $value = var_export($value, true);
            $result .= <<<CODE

    const {$name} = $value;

CODE;
        }
        return $result;
    }
639458
private function getParentClasses(string $class, $parentClass = []) : array
    {
        if (!$parentClass) {
            $parentClass[] = $class;
        }

        $parent = get_parent_class($class);
        if ($parent) {
            $parentClass[] = $parent;
            $parentClass = self::getParentClasses($parent, $parentClass);
        }

        return $parentClass;
    }
481550
public function fetchAllObj(string $class = null): array
    {
        if (!$this->wasExecuted()) {
            $this->exec();
        }

        if ($class === null) {
            return $this->getAdapter()->getStatement()->fetchAll(\PDO::FETCH_OBJ);
        } else {
            $objectInstances = [];

            foreach ($this->fetchAll() as $r) {
                $objectInstances[] = new $class($r);
            }

            return $objectInstances;
        }
    }
1118946
public static function getConstants($class, string $prefix = ''): array
    {
        static $constants = [];

        if (is_object($class)) {
            $class = get_class($class);
        }

        if (!isset($constants[$class])) {
            $constants[$class][''] = (new \ReflectionClass($class))->getConstants();
        }

        if (!isset($constants[$class][$prefix])) {
            $constants[$class][$prefix] = [];

            foreach ($constants[$class][''] as $name => $value) {
                if (Strings::startsWith($name, $prefix)) {
                    $constants[$class][$prefix][$name] = $value;
                }
            }
        }

        return $constants[$class][$prefix];
    }
690892
public static function parseParameters(Method $method) : array
	{
		$taskName = NULL;
		if ($method->hasAnnotation(Parameters::TASK)) {
			$className = $method->getDeclaringClass()->getName();
			$methodName = $method->getName();
			$taskName = $className . ' - ' . $methodName;
		}

		$taskAnnotation = $method->getAnnotation(Parameters::TASK);

		$parameters = [
			static::TASK => is_string($taskAnnotation)
				? Parser::parseName($taskAnnotation)
				: $taskName,
			static::PERIOD => $method->hasAnnotation(Parameters::PERIOD)
				? Parser::parsePeriod((string) $method->getAnnotation(Parameters::PERIOD))
				: NULL,
			static::DAYS => $method->hasAnnotation(Parameters::DAYS)
				? Parser::parseDays((string) $method->getAnnotation(Parameters::DAYS))
				: NULL,
			static::TIME => $method->hasAnnotation(Parameters::TIME)
				? Parser::parseTimes((string) $method->getAnnotation(Parameters::TIME))
				: NULL,
		];

		return $parameters;
	}
435486
protected function getDependencies($class): array
    {
        if (isset($this->reflections[$class])) {
            return [$this->reflections[$class], $this->dependencies[$class]];
        }

        $dependencies = [];

        try {
            $reflection = new ReflectionClass($class);
        } catch (\ReflectionException $e) {
            throw new InvalidConfigException('Failed to instantiate "' . $class . '".', 0, $e);
        }

        $constructor = $reflection->getConstructor();
        if ($constructor !== null) {
            foreach ($constructor->getParameters() as $param) {
                if ($param->isDefaultValueAvailable()) {
                    $dependencies[] = $param->getDefaultValue();
                } else {
                    $c = $param->getClass();
                    /// TODO think of disallowing `Reference(null)`
                    $dependencies[] = new Reference($c === null ? null : $c->getName());
                }
            }
        }

        $this->reflections[$class] = $reflection;
        $this->dependencies[$class] = $dependencies;

        return [$reflection, $dependencies];
    }
754256
public function getOptions()
    {
        $ret = array();
        if (!empty($this->taskDef['opts'])) {
            foreach ($this->taskDef['opts'] as $opt) {
                $ret[] = $opt->name;
            }
        }
        return $ret;
    }
752
protected function _getConfig($class)
    {
        $rClass = new \ReflectionClass($class);

        // Delegate actually loading the config for the class to the ClassAnnotationDriver
        $classDriver = new ClassAnnotationDriver($rClass, $this->annotationReaderFactory, $this->annotationNamespace);

        return $classDriver->getConfig();

    }
298186
public function getTraitsOfClass($class)
    {
        $definitions = [];

        // in case there is a hierarchy of classes
        $classes = $this->getSuperClasses($class);
        if (is_array($classes)) {
            foreach ($classes as $subClass) {
                if (isset($subClass['traits'])) {
                    foreach ($subClass['traits'] as $classTrait) {
                        foreach ($this->traits as $trait) {
                            if ($classTrait === $trait['trait']) {
                                $traitDefinition[$trait['trait']] = $trait;
                                $definitions = array_merge($definitions, $traitDefinition);
                            }
                        }
                    }
                }
            }
        }

        // trait used by the given class
        $classDefinition = isset($this->classes[$class]) ? $this->classes[$class] : null;
        if (!$classDefinition || empty($classDefinition['traits'])) {
            return $definitions;
        }
        $classTraits = $classDefinition['traits'];
        foreach ($this->traits as $trait) {
            foreach ($classTraits as $classTrait => $name) {
                if ($trait['trait'] === $name) {
                    $traitDefinition[$name] = $trait;
                    $definitions = array_merge($definitions, $traitDefinition);
                }
            }
        }

        return $definitions;
    }
26494
public static function getConstants($objectOrClass): array
    {
        try {
            $reflectionClass = self::getReflectionClass($objectOrClass);
            return $reflectionClass->getConstants();
        } catch (\Exception $e) {
            return [];
        }
    }
737153
public function getConfig($class)
    {
        foreach ($this->providers as $provider) {
            $config = $provider->getConfig($class);
            if ($config) {
                return $config;
            }
        }
        return null;
    }
902579
public function make($class, array $params = null)
    {
        if ($class == 'array') {
            return [];
        }

        $reflected = $this->reflect($class);

        if (empty($reflected->getConstructor())) {

            if ($reflected->isInterface()) {

                if ($match = $this->findMatchInParams($reflected, $params)) {
                    return $this->make($match->getName());
                }

                throw new IocNotResolvableException(
                    'Cannot instantiate ' . $reflected->getName()
                );
            }

            return $reflected->newInstance();
        }

        $dependencies = $this->getDependencies($reflected);

        $instanceArgs = $this->resolveDependencies($dependencies, $params);

        $instanceArgs = $this->setArgsValues($params, $instanceArgs);

        if (count($dependencies) != count($instanceArgs)) {
            throw new UnresolvedDependenciesException(
                'Could not resolve all dependencies', [
                'Required' => $dependencies,
                'Resolved' => $instanceArgs
            ]);
        }
        $instanceArgs = $this->mergeArgsAndParams($instanceArgs, $params);

        return $reflected->newInstanceArgs($instanceArgs);
    }
812291
public static function getTraits($class, bool $autoload = true): array
	{
		// Fetch all traits used by a class and its parents

		$traits = [];

		do
		{
			$traits += class_uses($class, $autoload);
		}
		while($class = get_parent_class($class));

		// Find all traits used by the traits

		$search = $traits;

		$searched = [];

		while(!empty($search))
		{
			$trait = array_pop($search);

			if(isset($searched[$trait]))
			{
				continue;
			}

			$traits += $search += class_uses($trait, $autoload);

			$searched[$trait] = $trait;
		}

		// Return complete list of traits used by the class

		return $traits;
	}
714650
protected function getDependencies($class)
    {
        if (isset($this->_reflections[$class])) {
            return [$this->_reflections[$class], $this->_dependencies[$class]];
        }

        $dependencies = [];
        $reflection = new ReflectionClass($class);

        $constructor = $reflection->getConstructor();
        if ($constructor !== null) {
            foreach ($constructor->getParameters() as $param) {
                if ($param->isDefaultValueAvailable()) {
                    $dependencies[] = $param->getDefaultValue();
                } else {
                    $c = $param->getClass();
                    $dependencies[] = Instance::of($c === null ? null : $c->getName());
                }
            }
        }

        $this->_reflections[$class] = $reflection;
        $this->_dependencies[$class] = $dependencies;

        return [$reflection, $dependencies];
    }