@param string $religionOrBelief

@throws \InvalidArgumentException

@return Diversity
490854
public function setReligionOrBelief($religionOrBelief)
    {
        if (!is_string($religionOrBelief) && !is_null($religionOrBelief)) {
            throw new \InvalidArgumentException(__CLASS__ . ' ' . __METHOD__ . ': Not a string');
        }

        $this->religionOrBelief = $religionOrBelief;

        return $this;
    }
342390
public function fromUri(Uri $uri): Configuration
    {
        $filename = (string) $uri;

        if (!file_exists($filename)) {
            throw new \InvalidArgumentException(sprintf('File %s could not be found', $filename));
        }

        $xml = new \SimpleXMLElement($filename, 0, true);
        foreach ($this->strategies as $strategy) {
            if ($strategy->supports($xml) !== true) {
                continue;
            }

            return new Configuration($this->applyMiddleware($strategy->convert($xml)));
        }

        throw new RuntimeException('No supported configuration files were found');
    }
731018
public function withRecursionDepth($depth)
    {
        if (null !== $depth && !(is_int($depth) && $depth >= 0)) {
            $msg = 'Recursion depth must be null (infinite) or integer >= 0!';
            throw new \InvalidArgumentException($msg);
        }

        $self = clone $this;
        $self->recursionDepth = $depth;

        return $self;
    }
779286
public function getEntityPathFromURI($uri)
    {
        if ($parts = $this->decomposeURI($uri)) {
            return $this->getEntityPath($parts['type'], $parts['id']);
        }

        throw new \InvalidArgumentException(sprintf("%s: invalid entity URI scheme or malformed URI", $uri));
    }
1237077
public function removeMethod($nameOrMethod) {
		if ($nameOrMethod instanceof PhpMethod) {
			$nameOrMethod = $nameOrMethod->getName();
		}

		if (!$this->methods->has($nameOrMethod)) {
			throw new \InvalidArgumentException(sprintf('The method "%s" does not exist.', $nameOrMethod));
		}
		$m = $this->methods->get($nameOrMethod);
		$m->setParent(null);
		$this->methods->remove($nameOrMethod);

		return $this;
	}
859952
public function ChildrenOf($parentRef)
    {
        $parent = SiteTree::get_by_link($parentRef);

        if (!$parent && is_numeric($parentRef)) {
            $parent = DataObject::get_by_id(SiteTree::class, $parentRef);
        }

        if ($parent) {
            return $parent->Children();
        }
        return null;
    }
1123474
protected function getRepositoryByType($type)
    {
        if (BlockInterface::ENTITY_TYPE === $type) {
            return $this->blockRepository;
        }
        if (ContentInterface::ENTITY_TYPE === $type) {
            return $this->contentRepository;
        }
        throw new \InvalidArgumentException($type . "ins't supported");
    }
73837
public static function create($conf = null)
    {
        self::$defaultConf = new FakerinoConf();
        self::$defaultConf->loadConfiguration();
        if ($conf !== null) {
            $confArray = $conf;
            if (!is_array($conf)) {
                $confTypeFactory = new FileConfigurationLoaderFactory(
                    $conf
                );
                $confParser = $confTypeFactory->load();
                $confArray = $confParser->toArray();
            }
            $conf = $confArray;
        }
        self::$defaultConf = new FakerinoConf($conf);
        self::$defaultConf->loadConfiguration();

        return new FakeDataFactory(self::getDefaultHandler(), new DoctrineLayer(self::getDatabaseConfig()), new TwigTemplate());
    }
14077
public function setOnDiskConfiguration(?string $configFile = null): ConfigurationBuilder
    {
        $this->configFile = $configFile;

        if ($this->configFile) {
            if (file_exists($path = getcwd() . '/' . $this->configFile)) {
                $this->configFile = $path;
            }

            if (!file_exists($this->configFile)) {
                throw new \InvalidArgumentException('The specified config file is not a valid file.');
            }

            $info = pathinfo($this->configFile);

            $fileExt = strtolower($info['extension']);

            switch ($fileExt) {
                case 'xml':
                    $diskConfig = $this->loadXmlFile($this->configFile);
                    break;

                case 'yml':
                case 'yaml':
                    $diskConfig = Yaml::parse(file_get_contents($this->configFile));
                    break;

                default:
                    throw new \InvalidArgumentException(
                        sprintf(
                            'The specified config file should end in .xml or .yml/.yaml. Unrecognized extension [%s]',
                            $fileExt
                        )
                    );
            }

            $this->configParams = array_merge($this->configParams, $diskConfig);
        }

        return $this;
    }
1070501
public function sort($sortBy = self::SORT_BY_KEYS_ASC, $sortFlags = SORT_REGULAR)
    {
        /** @noinspection SpellCheckingInspection */
        $sortFunctions = [
            self::SORT_BY_KEYS_ASC    => 'ksort',
            self::SORT_BY_KEYS_DESC   => 'krsort',
            self::SORT_BY_VALUES_ASC  => 'asort',
            self::SORT_BY_VALUES_DESC => 'arsort',
        ];

        if (!isset($sortFunctions[$sortBy])) {
            throw new InvalidArgumentException("SortBy {$sortBy} not supported");
        }

        $function = $sortFunctions[$sortBy];
        $function($this->data, $sortFlags);

        return $this;
    }
1221386
public function load($entities, $depth = 1)
    {
        if (!\is_array($entities) && !$entities instanceof \Traversable) {
            throw new \InvalidArgumentException(self::E_MSG);
        }

        $entitiesByValueClassByIds = $this->sortEntitiesByValueClass($entities);
        foreach ($entitiesByValueClassByIds as $valueClass => $entitiesById) {
            $this->loadEntityValues($valueClass, $entitiesById);
        }

        $this->loadRelatedEntities($entities, $depth);
    }
1043224
public function setHasFixtures($hasFixtures)
    {
        if (!is_bool($hasFixtures)) {
            throw new \InvalidArgumentException('The attribute hasFixtures on the class Entity has to be boolean (' . gettype($hasFixtures) . ('object' === gettype($hasFixtures) ? ' ' . get_class($hasFixtures) : '') . ' given).');
        }

        $this->hasFixtures = $hasFixtures;

        return $this;
    }
1147578
public function base()
    {
        if (!$this->validate()) {
            throw new \InvalidArgumentException("Invalid URI: $this->uri");
        }
        $parts = [
            'scheme' => parse_url($this->uri, PHP_URL_SCHEME),
            'host' => parse_url($this->uri, PHP_URL_HOST),
        ];
        $parts['port'] = is_int($port = parse_url($this->uri, PHP_URL_PORT)) ? $port : getservbyname($parts['scheme'], 'tcp');
        return strtolower($parts['scheme'] . '://' . $parts['host'] . ':' . $parts['port']);
    }
667852
public function elem($elemDef, ...$params) : self {
            if (is_string($elemDef)) {
                $arrayArgs = $params;
            } else if (is_array($elemDef)) {
                $elemDefArr = $elemDef;
                $elemDef = array_shift($elemDefArr);
                $arrayArgs = $elemDefArr;
            } else {
                throw new \InvalidArgumentException("Invalid string or array in input: elem(" . gettype($elemDef). ")");
            }


            $arr = explode("@", $elemDef);
            $tagName = trim(strtolower(array_shift($arr)));


            $attrs = [];
            $qmIndex = 0;
            foreach ($arr as $attdef) {
                if ($attdef === "")
                    continue;
                list ($key, $val) = explode("=", $attdef, 2);
                if ( ! isset ($val)) {
                    $attrs[trim ($key)] = null;
                    continue;
                }

                $val = trim ($val);
                if (isset ($arrayArgs)) {
                    if ($val == "?" && isset ($arrayArgs[$qmIndex])) {
                        $val = $arrayArgs[$qmIndex];
                        $qmIndex++;
                    }
                }
                $attrs[trim($key)] = $val;
            }




            $newNode = new GoElementNode();
            if (isset ($this->emptyTags[$tagName]))
                $newNode->isEmptyElement = true;
            $newNode->name = $tagName;
            $newNode->attributes = $attrs;
            $this->curNode->childs[] = $newNode;
            $newNode->parent = $this->curNode;

            if ($newNode->parent instanceof GoDocumentNode) {
                $newNode->preWhiteSpace = "\n";
            } else {
                $newNode->preWhiteSpace = $newNode->parent->preWhiteSpace . "    ";
            }

            return $this->cloneit($newNode);
        }
1252150
public function select(string $type = null)
    {
        if (empty($type)) {
            $type = $this->provider;
        }

        $providers = $this->mergeProviders();
        if (!isset($providers[$type])) {
            throw new InvalidArgumentException(sprintf('Provider %s does not exist', $type));
        }

        $providerBeanName = $providers[$type];

        return App::getBean($providerBeanName);
    }
25912
public function convert($value, string $path = '', bool $allowSerializeEmpty = false): AbstractNode
    {
        if (null === $value) {
            return NullNode::create();
        }

        $type = gettype($value);

        if (!isset($this->typeMapping[$type])) {
            throw new \InvalidArgumentException(
                sprintf('Type %s is not supported, at path %s', is_object($value) ? get_class($value) : $type, $path)
            );
        }

        $node = $this->typeMapping[$type];

        return $node::create($value, $allowSerializeEmpty);
    }
178344
public function create($uri, $defaultScheme = null)
    {
        if (!is_string($uri)) {
            throw new InvalidArgumentException('URI must be a string.');
        }

        $scheme = Uri::parseScheme($uri);
        if (null === $scheme) {
            $scheme = $defaultScheme;
        }
        $schemeClass = $this->schemeClass($scheme);

        return new $schemeClass($uri);
    }