@param string|null $source

@return array
519469
public function joinToSql(string $source = null): array
    {
        if ($clause = $this->getJoinStrategy()) {
            return $clause->joinToSql($source);
        }

        return ['', []];
    }
517689
public function merge(RouterInterface $source = null)
    {
        if (null == $source) {
            return [
                $this->routes,
                $this->defaultParams,
            ];
        }
        list($routes, $params) = $source->merge();

        $this->routes        = array_merge($this->routes, $routes);
        $this->defaultParams = array_merge($this->defaultParams, $params);
    }
1003273
public static function parse($source) {
        $name = null;
        $value = null;

        if (preg_match_all('@(<\S*?'.'>)@', $source, $matches)) {
            $name = $matches[0][0];
        }
        if (preg_match_all('@\[default: (.*)\]@i', $source, $matches)) {
            $value = $matches[0][1];
        }
        return new static($name, $value);
    }
1220837
public function getPaths($source)
    {
        $source = $this->cleanSource($source);
        list(, $paths) = $this->parse($source);

        return $paths;
    }
1148561
protected function getListMap($source)
    {
        // Extract Map from ID / Text Fields:
        
        if ($source instanceof SS_List) {
            $source = $source->map($this->getIDField(), $this->getTextField());
        }
        
        // Convert Map to Array:
        
        if ($source instanceof Map) {
            $source = $source->toArray();
        }
        
        // Determine Invalid Types:
        
        if (!is_array($source) && !($source instanceof ArrayAccess)) {
            user_error('$source passed in as invalid type', E_USER_ERROR);
        }
        
        // Answer Data Source:
        
        return $source;
    }
761579
protected function fromArray($source)
    {
        $data = array();
        $columnNames = $this->getColumnNames();

        foreach ($source as $key => $value) {

            if (in_array($key, $columnNames)) {

                if (is_string($value)) {
                    $value = ($value);
                }

                $data[$key] = $value;
            }
        }

        return $data;
    }
135479
public function load($source)
    {
        if ($this->isFile($source)) {
            return $this->loadFile($source);
        } else {
            return $this->loadString($source);
        }
    }
803009
protected function parseSource(
        $source,
        DocumentFactoryInterface $documentFactory,
        ElementProcessorInterface $elementProcessor,
        ContextInterface $context
    ) {
        try {
            $parser = new Parser($documentFactory, $elementProcessor, $context);
            $things = $parser->parse($source);
            $gateway = new ThingGateway($this->iri);
            return (object)['items' => $gateway->export($things)];
        } catch (\OutOfBoundsException $e) {
            throw new OutOfBoundsException($e->getMessage(), $e->getCode());
        } catch (\RuntimeException $e) {
            throw new RuntimeException($e->getMessage(), $e->getCode());
        }
    }
1329807
protected function checkSource($source)
    {
        /** @var array */
        $sources = $this->registry->get('source', []);
        $result  = in_array($source, $sources) || in_array('*', $sources);

        return $result;
    }
1254836
public function getAvailableActions($source = null)
    {
        $actions = array();

        // Edit
        $editAction = craft()->elements->getAction('Edit');
        $editAction->setParams(array(
            'label' => Craft::t('Edit tag'),
        ));
        $actions[] = $editAction;

        // Delete
        $deleteAction = craft()->elements->getAction('Delete');
        $deleteAction->setParams(array(
            'confirmationMessage' => Craft::t('Are you sure you want to delete the selected tags?'),
            'successMessage'      => Craft::t('Tags deleted.'),
        ));
        $actions[] = $deleteAction;

        // Allow plugins to add additional actions
        $allPluginActions = craft()->plugins->call('addTagManagerActions', array($source), true);
        foreach ($allPluginActions as $pluginActions) {
            $actions = array_merge($actions, $pluginActions);
        }

        return $actions;
    }
730634
public function getRouteCollection($source = null)
    {
        if (null === $this->collection) {
            $this->collection = $this->loadRouteCollection($source);
        }

        return $this->collection;
    }
1209848
protected function castToArray($source)
    {
        if (is_array($source)) {
            return $source;
        }

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

        $array = [];

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

        return $array;
    }
763824
public static function source($source = null)
    {
        $ins = new static();
        $ins->source = $source;
        $ins->query = $source;
        if (is_object($source) && (is_a($source, "\Illuminate\Database\Eloquent\Builder") ||
                                  is_a($source, "\Illuminate\Database\Eloquent\Model"))) {
            $ins->model = $source->getModel();
        }
        $ins->cid = $ins->getIdentifier();
        $ins->sniffStatus();
        $ins->sniffAction();

        return $ins;
    }
851260
private function getFileContents($source)
    {
        $this->assertSourceExists($source);
        $this->assertSourceIsNotFolder($source);
        $content = file_get_contents($source, true);

        $this->assertContentIsProperLoaded($source, $content);
        $this->assertContentIsNotEmpty($source, $content);

        return $content;
    }
1081560
public function getMetadata($source)
    {
        $fields = $this->query('PRAGMA table_info(' . $this->_escapeIdentifier($source) . ')', null, \PDO::FETCH_ASSOC);

        $attributes = [];
        $primaryKeys = [];
        $autoIncrementAttribute = null;

        foreach ($fields as $field) {
            $fieldName = $field['name'];

            $attributes[] = $fieldName;

            if ($field['pk'] === '1') {
                $primaryKeys[] = $fieldName;
            }

            if ($field['pk'] === '1' && $field['type'] === 'INTEGER') {
                $autoIncrementAttribute = $fieldName;
            }
        }

        $r = [
            Db::METADATA_ATTRIBUTES => $attributes,
            Db::METADATA_PRIMARY_KEY => $primaryKeys,
            Db::METADATA_AUTO_INCREMENT_KEY => $autoIncrementAttribute,
        ];

        return $r;
    }
398470
public function models(Source $source = null) {
		if ($source) {
			$this->applyStrategy($source);
		}
		return $this->_models;
	}
1044999
public function readSource($source)
    {
        $document = new \DOMDocument();
        $errorToExceptionContext = new ErrorToExceptionContext(E_WARNING, function () use ($source, $document) {
            $document->loadXML($source);
        });
        $errorToExceptionContext->invoke();

        return $this->readDocument($document);
    }