Parse database and collection with dot between them
if there is no dot, then we assume - $target as collection
and getting db from this object

@param string $target

@return array
180151
private function getCompleteCollectionNamespace($target)
    {
        if (mb_strpos($target, '.') !== false) {
            return explode('.', $target);
        }

        return [$this->getDatabase()->getName(), $target];
    }
1238094
protected function interpretSpecialTargets(array $targets)
    {
        $normalized = [];

        foreach ($targets as $targetParts) {

            // Detect '*' and convert to all attributes
            if (count($targetParts) == 1 && trim(head($targetParts)) == '*') {
                $normalized += $this->makeTargetsForAllAttributes();
                continue;
            }

            $normalized[] = $targetParts;
        }

        return $normalized;
    }
1118960
public function getOneToMany($target, $key = null, $target_key = null){
        $factory = $this->_db->factory($target);
        if(null === $key){
            $key = $this->getPK();
        }
        if(null === $target_key){
            $target_key = $key;
        }
        
        return $factory->findManyBy($target_key, $this->get($key));
    }
599580
public function switchCommand($target = '')
    {
        if ($target === '' && $values = $this->arguments->getValues()) {
            $target = $values[0];
        }

        if ($target === '') {
            $target = $this->arguments->getOption('env');
        }

        $candidates = [];
        foreach ($this->_getEnvTypes() as $file) {
            if (strpos($file, $target) === 0) {
                $candidates[] = $file;
            }
        }

        if (count($candidates) !== 1) {
            return $this->console->error(['can not one file: :env', 'env' => implode(',', $candidates)]);
        }
        $target = $candidates[0];

        $glob = '@root/.env[._-]' . $target;
        $files = $this->filesystem->glob($glob);
        if ($files) {
            $file = $files[0];
            $this->filesystem->fileCopy($file, '@root/.env', true);
            if (file_exists($file . '.php')) {
                $this->filesystem->fileDelete($file . '.php');
            }
            $this->console->writeLn(['copy `:src` to `:dst` success.', 'src' => basename($file), 'dst' => '.env']);
            return 0;
        } else {
            return $this->console->error(['dotenv file `:file` is not exists', 'file' => $glob]);
        }
    }
986574
protected function parseRow($row)
    {
        list($k, $v) = explode(':', $row, 2);

        if (preg_match('/^db\d+$/', $k)) {
            $v = $this->parseDatabaseStats($v);
        }

        return array($k, $v);
    }
1310400
public function getOneToOne($target, $key = null, $target_key = null){
        $factory = $this->_db->factory($target);
        if(null === $key){
            $key = $this->getPK();
        }
        if(null === $target_key){
            $target_key = $factory->getPK();
        }
        
        return $factory->findOneBy($target_key, $this->get($key));
    }
399396
public static function extractPrefix(string $prefix, $origin, $target = null)
    {
        $target = is_object($target) ? (object) $target : (array) $target;

        foreach ((array) $origin as $key => $val) {
            $key = $prefix . $key;

            if (!Arr::get($target, $key)) {
                $target = Arr::set($target, $key, $val);
            }
        }

        return $target;
    }
342012
public function getEdge( $source, $target )
	{
		if( $source->getNodeName() < $target->getNodeName() )
			return $this->edgeSet->getEdge( $source, $target );
		else
			return $this->edgeSet->getEdge( $target, $source );
	}
638626
private static function callMapClass($target): \ReflectionClass
    {
        $class = self::reflect($target);
        if (!isset(self::$classes[$class->getName()])) {
            self::$classes[$class->getName()] = self::forkCallMapClass($class);
        }

        return self::$classes[$class->getName()];
    }
1145106
protected static function modelsFor(array $targets)
    {
        $models = [];

        foreach ($targets as $target) {
            $models[] = collect((new ReflectionClass($target))->getProperties())->map(function ($property) use ($target) {
                $property->setAccessible(true);

                $value = $property->getValue($target);

                if ($value instanceof Model) {
                    return [$value];
                } elseif ($value instanceof EloquentCollection) {
                    return $value->flatten();
                }
            })->collapse()->filter()->all();
        }

        return collect(Arr::collapse($models))->unique();
    }
982464
public static function from($target)
    {
        if ($tags = static::explicitTags([$target])) {
            return $tags;
        }

        return static::modelsFor([$target])->map(function ($model) {
            return FormatModel::given($model);
        })->all();
    }
388431
public static function data_get($target, $key, $default = null)
	{
		if (is_null($key)) {
			return $target;
		}
		$key = is_array($key) ? $key : explode('.', $key);
		while (! is_null($segment = array_shift($key))) {
			if ($segment === '*') {
				if (! is_array($target)) {
					return $default;
				}
				$result = static::pluck($target, $key);
				return in_array('*', $key) ? static::collapse($result) : $result;
			}
			if (static::accessible($target) && static::exists($target, $segment)) {
				$target = $target[$segment];
			} elseif (is_object($target) && isset($target->{$segment})) {
				$target = $target->{$segment};
			} else {
				return $default;
			}
		}
		return $target;
	}
772138
public function getManyToMany($target, $through, $key = null, $target_key = null){
        $factory = $this->_db->factory($target);

        if(null === $key){
            $key = $this->getPK();
        }
        if(null === $target_key){
            $target_key = $factory->getPK();
        }
        
        $through = $this->parseThrough($through);
        if(!$through[1]){
            $through[1] = $key;
        }
        if(!$through[2]){
            $through[2] = $target_key;
        }
        
        $rows = $this->_db->builder()
            ->select('t.*')
            ->from($factory->getTable().' t')
            ->leftJoin($through[0].' m', 'm.'.$through[2].'=t.'.$target_key)
            ->where('m.'.$through[1].'=:value', array(
                ':value' => $this->get($key)
            ))
        ->queryAll();
        
        if(false === $rows){
            return false;
        }
        
        return $factory->mapModels($rows);
    }
127623
protected function mapJoinTable(array $target = [], array $source = [])
    {
        $joinTable['name'] = $target['name'];

        if ($this->hasJoinColumns($target)) {
            $joinTable['joinColumns'] = $this->mapJoinColumns(
                $target['joinColumns'],
                $source['joinColumns']
            );
        }

        if ($this->hasInverseJoinColumns($target)) {
            $joinTable['inverseJoinColumns'] = $this->mapJoinColumns(
                $target['inverseJoinColumns'],
                $source['inverseJoinColumns']
            );
        }

        return $joinTable;
    }
626938
protected function findByMetaSetAndTarget(MetaSetInterface $metaSet, $target = null)
    {
        $metaDatas = array();

        foreach ($this->findMetaDataValues($metaSet, $target) as $metaDataValue) {
            $identifier = $metaDataValue->getSetId();

            if (!isset($metaDatas[$identifier])) {
                $metaData = new MetaData($metaSet);
                $metaDatas[$identifier] = $metaData;
            } else {
                $metaData = $metaDatas[$identifier];
            }

            $field = $metaSet->getFieldById($metaDataValue->getFieldId());

            if (!$field) {
                $this->logger->error(sprintf("MetaSet with id %s doesn't exist", $metaDataValue->getFieldId()));
                continue;
            }

            $metaData->set($field->getName(), $metaDataValue->getValue(), $metaDataValue->getLanguage());
        }

        return $metaDatas;
    }
904756
protected function optimizeTargets(array $targets): array
    {
        if (($data = $this->tryToEncodeTargetsAsSwitch($targets)) !== null) {
            $isOptimizedForSwitch = true;
            assert(count($data) === 2); // context key and value => rule ID pairs.
        } else {
            $isOptimizedForSwitch = false;
            $data = [];
            foreach ($targets as $ruleId => $target) {
                $data[$ruleId] = $this->encodeTarget($target);
            }
        }

        return [$isOptimizedForSwitch, $data];
    }
139139
protected function _getClassName($target)
    {
        $className = $target;
        if (is_object($target)) {
            $className = get_class($target);
        }

        return $this->_normalizeName($className);
    }