@param object $target

@return object|string
512938
private function findScope(/*object */$target, string $property)
    {
        if (\property_exists($target, $property)) {
            return $target;
        }

        return $this->findParentScope($target, $property);
    }
616687
function setTarget($target)
    {
        if (!$target instanceof aSapi)
            throw new \InvalidArgumentException(sprintf(
                'Application Target Must Instanceof aSapi; given: (%s).'
                , \Poirot\Std\flatten($target)
            ));

        parent::setTarget($target);
        return $this;
    }
340518
public function lookup($target)
    {
        // Check if IP
        if (filter_var($target, FILTER_VALIDATE_IP)) {
            return $this->lookupIP($target);
        }

        // Check if domain
        if ($this->verifyDomainName($target)) {
            return $this->lookupDomain($target);
        }

        // Throw an error if both are false
        throw new WhoisException('The target supplied does not appear to be a valid IP or domain name.');
    }
1192716
private function getTargetResult($target, $context=null)
    {
        if ($context===null && \is_string($target) && strpos($target, '<') === false) {
            $context = $this->document;
        }

        return $context === null ? self::create($target) : self::create($target, $context);
    }
699305
private function getResolvedBase($target){

        $base = null;
        $array = $this->get($target);

        if(is_string($array['base'])){
            $assetService = $this->getServiceManager()->get(AssetService::SERVICE_ID);
            $base = $assetService->getAsset($array['base']);

        } else if(is_array($array['base'])){

            $base = array(
                'css' => $this->resolveStylesheetUrl($array['base']['css']),
                'templates' => array()
            );

            foreach($array['base']['templates'] as $id => $path){
                $base['templates'][$id] = $this->resolveTemplatePath($path);
            }

        } else {
            throw new common_Exception('invalid type for theme base');
        }

        return $base;
    }
315146
protected static function get($target, $key, $default = null)
    {
        if (is_null($key)) {
            return $target;
        }

        $key = is_array($key) ? $key : explode('.', $key);

        while (($segment = array_shift($key)) !== null) {
            if ($segment === '*') {
                if (! is_array($target)) {
                    return $default instanceof Closure ? $default() : $default;
                }

                $result = static::pluck($target, $key);

                return in_array('*', $key) ? static::collapse($result) : $result;
            }

            if (is_array($target) && array_key_exists($segment, $target)) {
                $target = $target[$segment];
            } elseif (is_object($target) && isset($target->{$segment})) {
                $target = $target->{$segment};
            } else {
                return $default instanceof Closure ? $default() : $default;
            }
        }

        return $target;
    }
747314
protected function addOriginToTargetUrl($target)
    {
        $origin = $this->request->getFullRoute();
        $additionalQuery = '_origin=' . base64_encode($origin);
        
        $parts = parse_url($target);
        
        if ($parts === false) {
            return $target;
        }
        
        if (!isset($parts['query'])) {
            $parts['query'] = '';
        } else if ($parts['query'] !== '') {
            $parts['query'] .= '&';
        }
        
        $parts['query'] .= $additionalQuery;
        return $this->buildUrl($parts);
    }
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]);
        }
    }
399035
public function targetSerialize($target = self::SER_DEFAULT, $params = null)
    {
        return $this->format($this->format);
    }
1088343
protected function extractPaths($target)
    {
        $paths = array(array($target));

        for ($key = 0; isset($paths[$key]); ++$key) {
            $path = $paths[$key];

            if (!empty($this->previous[$path[0]])) {
                foreach ($this->previous[$path[0]] as $previous) {
                    $copy = $path;
                    array_unshift($copy, $previous);
                    $paths[] = $copy;
                }
                unset($paths[$key]);
            }
        }

        return array_values($paths);
    }
456520
public function prependTo($target)
    {
        $target_result = $this->getTargetResult($target);

        $target_result->prepend($this);
        $this->remove();

        return $target_result;
    }
334941
protected function getIndex($target){
        if(is_string($target)){
            if(!class_exists($target) && !interface_exists($target)){
                throw new \InvalidArgumentException(
                    "Searche target must be specified by class name or"
                    . " interface name."
                );
            }

            foreach($this->queue as $index => $middleware){
                if(
                    get_class($middleware) === $target
                    || is_subclass_of($middleware, $target)
                ){
                    return $index;
                }
            }
        }elseif(is_object($target)){
            if(!$target instanceof MiddlewareInterface){
                $class  = MiddlewareInterface::class;
                throw new \InvalidArgumentException(
                    "Searche target must be an instance of a class that"
                    . " implements {$class}."
                );
            }

            foreach($this->queue as $index => $middleware){
                if($target === $middleware){
                    return $index;
                }
            }
        }else{
            throw new \InvalidArgumentException(
                "The searche target must be specified by object or string."
            );
        }

        return null;
    }
945756
public function copy($target) {
        if (!parent::copy($target))
            return false;
        return file_put_contents($target, $this->content) !== false;
    }
279039
public function copy($target) {
        if (!parent::copy($target))
            return false;
        return copy($this->fileSource, $target);
    }
348956
public static function get($name = null, $target = '')
    {
        if (!func_num_args()) {
            return static::$_matchers;
        }
        if ($target === true) {
            return isset(static::$_matchers[$name]) ? static::$_matchers[$name] : [];
        }
        if ($target === '') {
            if (isset(static::$_matchers[$name][''])) {
                return static::$_matchers[$name][''];
            }
            throw new Exception("Unexisting default matcher attached to `'{$name}'`.");
        }
        if (isset(static::$_matchers[$name][$target])) {
            return static::$_matchers[$name][$target];
        } elseif (isset(static::$_matchers[$name][''])) {
            return static::$_matchers[$name][''];
        }
        throw new Exception("Unexisting matcher attached to `'{$name}'` for `{$target}`.");
    }
853864
public static function dataGet($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 ($target instanceof Collection) {
                    $target = $target->all();
                } elseif (! is_array($target)) {
                    return Str::value($default);
                }

                $result = Arr::pluck($target, $key);

                return in_array('*', $key) ? Arr::collapse($result) : $result;
            }

            if (Arr::accessible($target) && Arr::exists($target, $segment)) {
                $target = $target[$segment];
            } elseif (is_object($target) && isset($target->{$segment})) {
                $target = $target->{$segment};
            } else {
                return Str::value($default);
            }
        }

        return $target;
    }
775157
private function getTargetParamsFromTarget( $target ) {
		if( $target instanceof EntityId ) {
			return array( 'id' => $target->getSerialization() );
		} elseif( $target instanceof SiteLink ) {
			return array(
				'site' => $target->getSiteId(),
				'title' => $target->getPageName(),
			);
		} else {
			throw new UnexpectedValueException( '$target needs to be an EntityId or SiteLink' );
		}
	}