Checks if all dependent classnames are defined

@param Loops\ArrayObject $config The additiona config that will be merged into the default config.
@param Loops $loops The loops context
@return bool TRUE if all dependencies are defined
515780
public static function hasService(Loops $loops) {
        foreach(static::getDependencies($loops) as $classname) {
            if(!class_exists($classname)) {
                return FALSE;
            }
        }

        return TRUE;
    }
118779
private static function hasDefaultImplementer($hookName, $alternativePath = NULL) {
        $classPath = $alternativePath ? $alternativePath : '\\Quantum\\Hooks\\HookDefaults';
        $class = new \ReflectionClass($classPath);

        if ($class->hasMethod($hookName)) {
            return $class->getName();
        }

        return FALSE;
    }
725395
protected function doesContainsObjects(array $objects) : bool
    {
        $this->toOrderedMap();

        foreach ($objects as $object) {
            if (!isset($this->instanceMap[$object])) {
                return false;
            }
        }

        return true;
    }
1293287
public function load($config = array())
    {
        foreach ($config as $specId => $spec) {
            if (is_string($spec)) {
                $spec = array('class' => $spec);
            }

            $file = isset($spec['src']) ? $spec['src'] : null;

            // class is whatever's explicitly set,
            $class = isset($spec['class']) ? $spec['class'] : null;

            // or the specid if nothing else available.
            if (!$class && is_string($specId)) {
                $class = $specId;
            }

            // make sure the class is set...
            if (empty($class)) {
                throw new InvalidArgumentException('Missing spec class');
            }
            $spec['class'] = $class;

            $id = is_string($specId)
                ? $specId
                : (isset($spec['id']) ? $spec['id'] : $class);

            $priority = isset($spec['priority']) ? $spec['priority'] : 1;

            // see if we already have this defined. If so, check priority weighting
            if (isset($this->specs[$id]) && isset($this->specs[$id]['priority'])) {
                if ($this->specs[$id]['priority'] > $priority) {
                    return $this;
                }
            }

            // okay, actually include it now we know we're going to use it
            if (file_exists($file)) {
                require_once $file;
            }

            // make sure to set the id for later when instantiating
            // to ensure we get cached
            $spec['id'] = $id;

//          We've removed this check because new functionality means that the 'class' field doesn't need to refer
//          specifically to a class anymore - it could be a compound statement, ala SilverStripe's old Object::create
//          functionality
//
//          if (!class_exists($class)) {
//              throw new Exception("Failed to load '$class' from $file");
//          }

            // store the specs for now - we lazy load on demand later on.
            $this->specs[$id] = $spec;

            // EXCEPT when there's already an existing instance at this id.
            // if so, we need to instantiate and replace immediately
            if (isset($this->serviceCache[$id])) {
                $this->updateSpecConstructor($spec);
                $this->instantiate($spec, $id);
            }
        }

        return $this;
    }
191004
public function checkArrayOfType(array $config)
    {
        if (\count($config) === 1 && isset($config[0])) {
            $type = $this->createType($config[0]);
            return $this->createArrayOfType($type);
        }
        return null;
    }
457685
public static function checkConfig(&$config, $instanceOf = null, $removeClass = true)
    {
        // Get class from config
        $class = static::getClassFromConfig($config, $removeClass);

        // Make sure we have a valid class
        if ($instanceOf && !is_subclass_of($class, $instanceOf)) {
            static::throwInvalidInstanceException($class, $instanceOf);
        }

        return $class;
    }
88465
public function isSelected($config, $checkType)
    {
        $selected = false;

        if (!is_object($config['objectValue'])) {
            $selected = (isset($config['inputs'][$config['name']])
                || isset($config['config']['selected'])
                || $config['objectValue'] === 'on'
                || ($config['objectValue'] == 1 && $checkType == 'checked')
                || is_array(json_decode($config['objectValue']))) ? $checkType : '';
        }

        return $selected;
    }
1196626
public function check(array $config): bool
    {
        $additionalOptions = Arr::get($config, 'additional_options', '');

        $this->output = $this->composer->installDryRun('--no-dev ' . $additionalOptions);

        return str_contains($this->output, 'Nothing to install or update');
    }
1328135
public static function config($config = null) {
		$defaults = ['scope' => null];

		if (is_array($config)) {
			foreach ($config as $i => $item) {
				$config[$i] += $defaults;
			}
		}
		return parent::config($config);
	}
357055
public function javascript($config = array())
    {
        return $this->getTemplate()->helper('behavior.bootstrap', array(
            'debug' => JFactory::getApplication()->getCfg('debug'),
            'css' => false,
            'javascript' => true
        ));
    }
915487
protected static function _has(AnConfig $config)
    {
        //since the mixer is a singleton use the mixer object directly
        $description = $config['description'];

        //set the default cardinality 
        //If name singular 1 else many 		
        $config->append(array(
            'cardinality' => AnInflector::isSingular($config['name']) ? 1 : 'many',
        ));

        $cardinality = (int) $config->cardinality;

        $config->parent = $description->getEntityIdentifier();

        //a one to one relationship
        if (is_numeric($config->cardinality) && (int) $cardinality == 1) {
            $relationship = AnDomainPropertyAbstract::getInstance('relationship.onetoone', $config);

            //add the belnogs to relation to the child description
            //if it doesn't exists. Since it's a one-to-one relatonship
            //the parent entity uniquly identifies the child entity
            $child_description = $relationship->getChildRepository()->getDescription();
            $property = $child_description->getProperty($relationship->getChildKey());

            if (!$property) {
                $property = $child_description->setRelationship($relationship->getChildKey(), array('type' => 'belongs_to', 'parent' => $relationship->getParent()));
            }

            if ($relationship->isRequired()) {
                $child_description->addIdentifyingProperty($property);
            }
        }
        //if a through is not set then it's just one-to-many relationship
        elseif (!$config->through) {
            $relationship = AnDomainPropertyAbstract::getInstance('relationship.onetomany', $config);

            //the child repository must have a belongs to relationship
            //if not then lets create one for it automatically
            if (!$relationship->getChildProperty()) {
                $child_key = $relationship->getChildKey();
                $belongs_to_options = array('parent' => $description->getEntityIdentifier(),'type' => 'belongs_to');

                if ($config->child_column) {
                    $belongs_to_options['child_column'] = $config->child_column;
                }

                if ($config->parent_key) {
                    $belongs_to_options['parent_key'] = $config->parent_key;
                }

                $property = $relationship->getChildRepository()->getDescription()->setRelationship($child_key, $belongs_to_options);
            }
        } else {
            $through_one_to_many = null;

            //if subscription is through a one-to-many relationship		
            if (strpos($config->through, '.') === false && $through_one_to_many = $description->getProperty($config->through)) {
                unset($config->through);

                $config->append(array(
                    'parent_delete' => $through_one_to_many->getDeleteRule(),
                    'as' => $through_one_to_many->getName(),
                    'through' => $through_one_to_many->getChild(),
                    'parent' => $through_one_to_many->getParent(),
                    'child_key' => $through_one_to_many->getChildKey(),
                    'parent_key' => $through_one_to_many->getParentKey(),
                ));
            }

            $relationship = AnDomainPropertyAbstract::getInstance('relationship.manytomany', $config);

            //lets create a child relationship for the parent
            //in the link entity if it doesn't exists			
            if (!$relationship->getChildProperty()) {
                $child_key = $relationship->getChildKey();

                $belongs_to_options = array('parent' => $description->getEntityIdentifier(),'type' => 'belongs_to');

                if ($config->child_column) {
                    $belongs_to_options['child_column'] = $config->child_column;
                }

                $property = $relationship->getChildRepository()->getDescription()->setRelationship($child_key, $belongs_to_options);
            }

            //lets create a child relationship for the target
            //in the link entity if it doesn't exists
            if (!$relationship->getTargetChildProperty()) {
                $child_key = $relationship->getTargetChildKey();

                $belongs_to_options = array('type' => 'belongs_to','parent' => $relationship->getTargetRepository()->getDescription()->getEntityIdentifier());

                if ($config->target_child_column) {
                    $belongs_to_options['target_child_column'] = $config->child_column;
                }

                $property = $relationship->getChildRepository()->getDescription()->setRelationship($child_key, $belongs_to_options);
            }

            //create has_many relationship for both the parent and the target
            //if there's no relationship set before
            $parent = $relationship->getJunctionAlias();
            $target = $parent;

            if (empty($through_one_to_many)) {
                $through_one_to_many = $description->setRelationship($target, array(
                        'type' => 'has',
                        'cardinality' => $config->cardinality,
                        'child_key' => $relationship->getChildKey(),
                        'parent_key' => $relationship->getParentKey(),
                        'child' => $relationship->getChild(),
                        'parent_delete' => $relationship->getDeleteRule(),
                ));
            } elseif ($through_one_to_many->getName() != $target) {
                $description->setAlias($through_one_to_many->getName(), $target);
            }

            $through_one_to_many_target = $relationship->getTargetRepository()->getDescription()->setRelationship(
                             $parent, array(
                                'cardinality' => $config->cardinality,
                                'type' => 'has',
                                'child_key' => $relationship->getTargetChildKey(),
                                'parent_key' => $relationship->getTargetParentKey(),
                                'child' => $relationship->getChild(),
                                'parent_delete' => $relationship->getDeleteRule(),
                            ));

            /*
             * Duplicate Delete for two object that have has many to has many 
             * relationship with each other 
             */
// 			print $through_one_to_many_target->getParentRepository()->getIdentifier()->name.' has many '.$through_one_to_many_target->getName().'<br/>'.
// 			$through_one_to_many->getParentRepository()->getIdentifier()->name.' has many '.$through_one_to_many->getName().'<br/><hr/>';
        }

        return $relationship;
    }
204268
protected static function _class($config, $paths = []) {
		if (!$config['adapter']) {
			$config['adapter'] = $config['type'];
		} else {
			$paths = array_merge(["adapter.data.source.{$config['type']}"], (array) $paths);
		}
		return parent::_class($config, $paths);
	}
1041946
public function config($config)
    {
        if (is_array($config)) {
            $this->config = array_merge($this->config, $config);
        } elseif (isset($this->config[$config])) {
            return $this->config[$config];
        } else {
            return;
        }
    }
181491
public function hasMethod($methodName)
    {
        $methodNameLower = strtolower($methodName);
        foreach ($this->methods as $name => $method) {
            if ($methodNameLower == $name) {
                return true;
            }
        }

        $extendsClassDefinition = $this->getExtendsClassDefinition();
        if ($extendsClassDefinition instanceof ClassDefinitionRuntime) {
            try {
                $extendsClassDefinition = $this->compiler->getInternalClassDefinition(
                    $extendsClassDefinition->getName()
                );
            } catch (\ReflectionException $e) {
                // Do nothing
                return false;
            }
        }

        while ($extendsClassDefinition instanceof self) {
            if ($extendsClassDefinition->hasMethod($methodName)) {
                return true;
            }

            $extendsClassDefinition = $extendsClassDefinition->getExtendsClassDefinition();
        }

        return false;
    }
258644
public function applyConfig(array $config)
    {
        $dataObjectClass = $this->getDataObjectClass();
        if (empty($config['fields'])) {
            throw new Exception(
                "No array of fields defined for $dataObjectClass"
            );
        }
        if (isset($config['fields'])) {
            if ($config['fields'] === SchemaScaffolder::ALL) {
                $this->addAllFields(true);
            } elseif (is_array($config['fields'])) {
                $this->addFields($config['fields']);
            } else {
                throw new Exception(
                    sprintf(
                        "Fields must be an array, or '%s' for all fields in $dataObjectClass",
                        SchemaScaffolder::ALL
                    )
                );
            }
        }

        if (isset($config['excludeFields'])) {
            if (!is_array($config['excludeFields']) || ArrayLib::is_associative($config['excludeFields'])) {
                throw new InvalidArgumentException(
                    sprintf(
                        '"excludeFields" must be an enumerated list of fields. See %s',
                        $this->getDataObjectClass()
                    )
                );
            }

            $this->removeFields($config['excludeFields']);
        }

        if (isset($config['fieldDescriptions'])) {
            if (!ArrayLib::is_associative($config['fieldDescriptions'])) {
                throw new InvalidArgumentException(
                    sprintf(
                        '"fieldDescripions" must be a map of field name to description. See %s',
                        $this->getDataObjectClass()
                    )
                );
            }

            foreach ($config['fieldDescriptions'] as $fieldName => $description) {
                $this->setFieldDescription($fieldName, $description);
            }
        }

        if (isset($config['operations'])) {
            if ($config['operations'] ===  SchemaScaffolder::ALL) {
                $config['operations'] = [];
                foreach (OperationScaffolder::getOperations() as $id => $operation) {
                    $config['operations'][$id] = true;
                }
            }

            if (!ArrayLib::is_associative($config['operations'])) {
                throw new Exception(
                    'Operations field must be a map of operation names to a map of settings, or true/false'
                );
            }

            foreach ($config['operations'] as $opID => $opSettings) {
                if ($opSettings === false) {
                    continue;
                }
                $this->operation($opID)
                    ->applyConfig((array)$opSettings);
            }
        }

        if (isset($config['nestedQueries'])) {
            if (!ArrayLib::is_associative($config['nestedQueries'])) {
                throw new InvalidArgumentException(
                    sprintf(
                        '"nestedQueries" must be a map of relation name to a map of settings, or true/false. See %s',
                        $this->getDataObjectClass()
                    )
                );
            }

            foreach ($config['nestedQueries'] as $relationName => $settings) {
                if ($settings === false) {
                    continue;
                } elseif (is_string($settings)) {
                    if (is_subclass_of($settings, QueryScaffolder::class)) {
                        $queryScaffolder = new $settings($relationName);
                        $this->nestedQuery($relationName, $queryScaffolder);
                    } else {
                        throw new InvalidArgumentException(sprintf(
                            'Tried to specify %s as a custom query scaffolder for %s on %s, but it is not a subclass of %s.',
                            $settings,
                            $relationName,
                            $this->getDataObjectClass(),
                            QueryScaffolder::class
                        ));
                    }
                } else {
                    $this->nestedQuery($relationName)
                        ->applyConfig((array)$settings);
                }
            }
        }

        return $this;
    }
917050
private function checkConfig($config){
		$config = Hash::merge($this->configDef,$config);
		$this->include = $config['include'];
		unset($config['include']);
    	$this->config= $config;
	}
202276
private function isValidConfig(array $config)
    {
        foreach ($this->configAttributes as $attribute) {
            if (!array_key_exists($attribute, $config)) {
                return false;
            }
        }

        return !empty($config['path']);
    }