@param mixed $source

@return SourceInterface
@throws InvalidSourceException
546862
protected static function makeSource($source): SourceInterface
    {
        if (is_array($source) || $source instanceof \ArrayAccess) {
            return new ArraySource($source);
        }

        if (is_object($source)) {
            return new ObjectSource($source);
        }

        throw new InvalidSourceException(
            sprintf('Source type "%s" cannot be recognized as suitable storage', gettype($source))
        );
    }
1106911
protected function evaluatePath($source)
    {
        static $theme;

        // Make theme to use few features.
        if ( ! $theme)
        {
            $theme = \App::make('theme');
        }

        // Switch path to another theme.
        if ( ! is_bool($this->usePath) and $theme->exists($this->usePath))
        {
            $currentTheme = $theme->getThemeName();

            $source = str_replace($currentTheme, $this->usePath, $source);
        }

        return $source;
    }
753311
public function invalidateCache($source, $context)
    {
        $key = $this->getSpecificSourceCacheKey(
            $source,
            $context
        );

        $this
            ->cache
            ->delete($this->getSpecificSourceCacheKey(
                $source,
                $context
            ));

        unset($this->commentTree[$key]);

        return $this;
    }
231873
public static function create($source)
    {
        if (is_array($source)) {
            $source = new Collection($source);
        }

        return parent::create($source);
    }
369111
public function setSource(Processable $source)
    {
        if ($source instanceof ExpressionProcessor) {
            parent::setSource($source);
        } else {
            $msg = "ExpressionProcessingException::setSource only accept ExpressionProcessor objects.";
            throw new InvalidArgumentException($msg);
        }
    }
904833
public static function setSource($source = null)
    {
        if (! is_resource($source) && ! is_null($source)) {
            throw new InvalidArgumentException(sprintf(
                'Invalid source provided; must be a null or an resource, "%s" given.',
                is_object($source) ? get_class($source) : gettype($source)
            ));
        }
        static::$source = $source;
    }
833842
public function setSource($source): Method
    {
        if (!empty($source)) {
            if (is_array($source)) {
                $this->source->setLines($source);
            } elseif (is_string($source)) {
                $this->source->setString($source);
            }
        }

        return $this;
    }
1267817
public function updateSource(Common\ISource $source)
    {
        return $this->update($source, $this->isGroupJoin, $this->filter, $this->hasDefault);
    }
1056398
public function setSource($source)
    {
        $crawler = $this->getCrawler();
        if (!is_null($crawler) && $crawler instanceof Crawler) {
            throw new ParserContextException('It is not allowed to update source when crawler is active.');
        }

        $this->source = $source;

        return $this;
    }
798957
public function addSource(Source $source)
    {
        $sources = array_map('strval', $this->sources->toArray());
        if (!in_array($source->getUrl(), $sources)) {
            $this->sources->add($source);
            $source->setItem($this);
        }

        return $this;
    }
1168806
protected function resolve($name)
    {
        $config = $this->getConfig($name);

        if (empty($config)) {
            throw new InvalidArgumentException("Source repository [{$name}] is not defined.");
        }

        if (isset($this->customSourceCreators[$config['type']])) {
            return $this->callCustomSourceCreators($config);
        }
        $repositoryMethod = 'create'.ucfirst($name).'Repository';

        if (method_exists($this, $repositoryMethod)) {
            return $this->{$repositoryMethod}($config);
        }
        throw new InvalidArgumentException("Repository [{$name}] is not supported.");
    }
44811
public function merge( $source ) {
		if ( $source instanceof self ) {
			$source = $source->to_array();
		}

		if ( ! is_array( $source ) ) {
			throw new InvalidArgumentException( 'Combine must be a Dictionary or an array' );
		}

		return new static( $this->get_key_type(), $this->get_value_type(), array_merge( $this->storage, $source ) );
	}
1312188
public function setSource( $source )
	{
		if( !file_exists( $source ) )
			throw new InvalidArgumentException( 'Image File "'.$source.'" is not existing.' );
		$size = @getimagesize( $source );
		if( !$size )
			throw new Exception( 'Source File "'.$source.'" is not a supported Image.' );
		$this->size		= $size;
		$this->source	= $source;
	}
903868
public function createDocumentFromSource($source)
    {
        if ($source instanceof \DOMDocument) {
            return $source;
        }

        throw new RuntimeException(RuntimeException::INVALID_DOM_SOURCE_STR, RuntimeException::INVALID_DOM_SOURCE);
    }
84307
protected function castToArray($source)
    {
        if (is_array($source)) {
            return array_values($source);
        }

        if (is_int($source)) {
            return range(0, $source);
        }

        if (is_string($source) && strlen($source) > 1) {
            return str_split($source);
        }

        if (is_string($source) && mb_strlen($source) == 1) {
            return range(mb_strtoupper($source) == $source ? 'A' : 'a', $source);
        }

        if (!$source instanceof Traversable) {
            throw new InvalidArgumentException('Source has to be \Traversable, array, string or int');
        }

        $array = [];

        foreach ($source as $item) {
            $array[] = $item;
        }

        return $array;
    }
582823
public function setSource($source)
    {
        $this->source = $this->getSourceAsArray($source);
        
        $this->updateViewportFields();
        
        return $this;
    }
562388
private function coalesceSources($source = null)
    {
        if (isset($source)) {
            return $source;
        } elseif (isset($this->source)) {
            return $this->source;
        }

        return $_SERVER;
    }