Get a Ref object in a project.

@param string          $refName
@param Project         $project
@param ClientInterface $client

@return static|false
970746
public static function fromName($refName, Project $project, ClientInterface $client)
    {
        $url = $project->getUri() . '/git/refs';

        return static::get($refName, $url, $client);
    }
1240208
public static function getReferrer(ServerRequestInterface $request)
    {
        if ($referrer = $request->getAttribute(self::REFERRER)) {
            return $referrer;
        }
        if ($referrer = Respond::session()->get(self::REFERRER)) {
            return $referrer;
        }
        $info = $request->getServerParams();

        return array_key_exists('HTTP_REFERER', $info) ? $info['HTTP_REFERER'] : '';
    }
257555
public function ref($ref1)
    {
        list($ref, $rest) = explode('/', $ref1, 2);

        if (!isset($this->_references[$ref])) {
            /** @type Field_Base $e */
            $e = $this->hasElement($ref);
            if ($e && $e->hasMethod('ref')) {
                return $e->ref();
            } else {
                throw $this->exception('Reference is not defined')
                    ->addMoreInfo('model', $this)
                    ->addMoreInfo('ref', $ref);
            }
        }

        $class = $this->_references[$ref];
        if (is_array($class)) { // hasMany
            if ($rest) {
                throw $this->exception('Cannot traverse multiple references');
            }
            $m = $this->_ref(
                $class[0],
                $class[1] && $class[1] != UNDEFINED ? $class[1] : $this->table.'_id',
                $class[2] && $class[2] != UNDEFINED ? $this[$class[2]] : $this->id
            );
        } else { // hasOne
            $id = $this->get($ref);
            /** @type Model $m */
            $m = $this->_ref(
                $class,
                null,
                $id
            );
            if ($id) {
                $this->hook('beforeRefLoad', array($m, $id));
                $m->load($id);
            }
        }
        if ($rest) {
            $m = $m->ref($rest);
        }

        return $m;
    }
607047
private function getPropertyValue(RefClass $refClass, $member)
    {
        $member = substr($member, 1);

        if (!isset($refClass->properties[$member])) {
            throw new MarkupException(sprintf('property %s::$%s does not exist', $refClass->name, $member));
        }

        return $refClass->properties[$member]->default;
    }
609142
public function evaluate()
    {
        if ($this->refid === null) {
            throw new BuildException(
                "No ref attribute specified for reference-exists "
                . "condition"
            );
        }
        $refs = $this->project->getReferences();

        return !($refs[$this->refid] instanceof UnknownElement) && isset($refs[$this->refid]);
    }
879408
private function getClient($clientName)
    {
        $clientName = $clientName ?: 'gbprod.elastica_provider.default_client';

        $client = $this->getContainer()
            ->get($clientName, ContainerInterface::NULL_ON_INVALID_REFERENCE)
        ;

        if (!$client) {
            throw new \InvalidArgumentException(sprintf(
                'No client "%s" found',
                $clientName
            ));
        }

        return $client;
    }
1024478
public function getClientScope($client_id)
    {
        // Get Client
        $client = $this->em->getRepository('OAuth2ServerBundle:Client')->find($client_id);

        if (!$client) {
            return false;
        }

        return implode(' ', $client->getScopes());
    }
111291
public static function getDefaultChain(ClientInterface $client)
    {
        $factories = array();
        if ($description = $client->getDescription()) {
            $factories[] = new ServiceDescriptionFactory($description);
        }
        $factories[] = new ConcreteClassFactory($client);

        return new static($factories);
    }
1067477
public function getProject()
    {
        if (!$this->hasLink('project') && !$this->isActive()) {
            throw new \BadMethodCallException('Inactive subscriptions do not have projects.');
        }
        $url = $this->getLink('project');
        return Project::get($url, null, $this->client);
    }
321185
public static function getRef($reference)
	{
		if (isset(self::$strings[$reference]))
		{
			return self::$strings[$reference];
		}

		return false;
	}
411792
public function refSQL($name, $load = null)
    {
        /** @type Field_Reference $ref */
        $ref = $this->getElement($name);

        return $ref->refSQL($load);
    }
296642
public function getProjectAccesses(Project $project, $reset = false)
    {
        if ($reset || !isset(self::$projectAccessesCache[$project->id])) {
            self::$projectAccessesCache[$project->id] = $project->getUsers();
        }

        return self::$projectAccessesCache[$project->id];
    }
227381
private static function getTpl($ref, $newClassName)
    {
        $class = $ref->getName();
        $methodsTpl = static::getMethodsTpl($ref, $class);
        $construct = '';
        $constructMethod = $ref->getConstructor();
        if(null !== $constructMethod)
        {
            $paramsTpls = static::getMethodParamTpls($constructMethod);
            $constructDefine = $paramsTpls['define'];
            $construct = "parent::__construct({$paramsTpls['call']});";
            if(static::hasAop($ref, '__construct'))
            {
                $aopConstruct = <<<TPL
        \$__args__ = func_get_args();
        {$paramsTpls['set_args']}
        \$__result__ = \$this->beanProxy->call(
            '__construct',
            function({$paramsTpls['define']}){
                \$__args__ = func_get_args();
                {$paramsTpls['set_args']}
                return parent::__construct(...\$__args__);
            },
            \$__args__
        );

TPL;
            }
            else
            {
                $aopConstruct = $construct;
            }
        }
        else
        {
            $constructDefine = '...$args';
            $aopConstruct = '';
        }
        $aopConstruct .= <<<TPL
\$this->beanProxy->injectProps();
TPL;
        if($ref->hasMethod('__init'))
        {
            if(isset($paramsTpls['call']))
            {
                $aopConstruct .= <<<TPL
        \$this->__init({$paramsTpls['call']});
TPL;
            }
            else
            {
                $aopConstruct .= <<<TPL
        \$this->__init();
TPL;
            }
        }
        $parentClone = $ref->hasMethod('__clone') ? 'parent::__clone();' : '';
        // 类模版定义
        $tpl = <<<TPL
class {$newClassName} extends {$class} implements \Imi\Bean\IBean
{
    protected \$beanProxy;

    public function __construct({$constructDefine})
    {
        \$this->beanProxy = new \Imi\Bean\BeanProxy(\$this);
        {$aopConstruct}
    }

    public function __clone()
    {
        \$this->beanProxy = new \Imi\Bean\BeanProxy(\$this);
        \$this->beanProxy->injectProps();
        {$parentClone}
    }
{$methodsTpl}
}
TPL;
        return $tpl;
    }
1320690
public function getReference(ConnectionInterface $con = null)
    {
        if ($this->aReference === null && ($this->reference_id !== null)) {
            $this->aReference = ChildReferenceQuery::create()->findPk($this->reference_id, $con);
            /* The following can be used additionally to
                guarantee the related object contains a reference
                to this object.  This level of coupling may, however, be
                undesirable since it could result in an only partially populated collection
                in the referenced object.
                $this->aReference->addVideos($this);
             */
        }

        return $this->aReference;
    }
1047023
function getReference($table, $ref = null) {
		if (isset($this->references[$table])) {
			if (!strlen($ref)) {
				return current($this->references[$table]);
			}
			if (isset($this->references[$table][$ref])) {
				return $this->references[$table][$ref];
			}
		}
	}
808796
public function copyInto(NodeInterface $referenceNode, $nodeName): NodeInterface
    {
        $this->emitBeforeNodeCopy($this, $referenceNode);
        $copiedNode = $this->copyIntoInternal($referenceNode, $nodeName, $this->getNodeType()->isAggregate());
        $this->emitAfterNodeCopy($this, $referenceNode);

        return $copiedNode;
    }
1324450
public static function instance( Client $client = null, StorageInterface $storage = null ) {
        if ( is_null( self::$_instance ) ) {
            self::$_instance = new self( $client, $storage );
        }

        return self::$_instance;
    }