returns reference to object in references container of project

@param Project|null $fallback

@return object
480854
public function getReferencedObject(Project $fallback = null)
    {
        $project = $fallback ?? $this->project;

        if ($this->refid === null) {
            throw new BuildException("No reference specified");
        }
        $o = $project->getReference($this->refid);
        if ($o === null) {
            throw new BuildException("Reference {$this->refid} not found.");
        }

        return $o;
    }
36997
public function get($key = null, $fallback = null)
    {
        $contents = $this->getContents();

        return Arr::get($contents, $key, $fallback);
    }
260052
public function get($configOption, $fallback = null)
    {
        if (isset($this->configuration[$configOption])) {
            $optionValue = $this->configuration[$configOption];
        } else {
            if (array_key_exists($configOption, $this->configuration)) {
                $optionValue = $fallback;
            }

            try {
                $optionValue = $this->repository->git(sprintf('config --get ' . $configOption));
                $this->configuration[$configOption] = $optionValue;
            } catch (GitRuntimeException $e) {
                $optionValue = $fallback;
                $this->configuration[$configOption] = null;
            }
        }

        return $optionValue;
    }
144807
public function getPreviousUrl(bool $fallBackToReferer = true) : string
    {
        if (!empty($this->previousUrl)) {
            return $this->previousUrl;
        }

        if ($fallBackToReferer) {
            return $this->headers->get('REFERER', '');
        }

        return '';
    }
727175
public function getObjectsByCollection(CollectionInterface $collection, callable $callback = null)
    {
        $iterator = $this->resourceRepository->findByCollectionNameIterator($collection->getName());
        $iteration = 0;
        foreach ($this->resourceRepository->iterate($iterator, $callback) as $resource) {
            /** @var PersistentResource $resource */
            $object = new StorageObject();
            $object->setFilename($resource->getFilename());
            $object->setSha1($resource->getSha1());
            $object->setMd5($resource->getMd5());
            $object->setFileSize($resource->getFileSize());
            $object->setStream(function () use ($resource) {
                return $this->getStreamByResource($resource);
            });
            yield $object;
            if (is_callable($callback)) {
                call_user_func($callback, $iteration, $object);
            }
            $iteration++;
        }
    }
626686
protected function get($configOption, $fallback = null) {
		return isset($this->configuration[$configOption]) ? $this->configuration[$configOption] : $fallback;
    }
928560
public function parseResultTheaterItem($fallbackUrl = null)
    {
        $resultItem = $this->parseResultItem($this->crawler, 'tid', '.address, .info', $fallbackUrl);

        if ($resultItem == null) {
            return null;
        }

        $theater = new Theater($resultItem);

        return $theater;
    }
1153120
public function getDir(Project $p)
    {
        if ($this->isReference()) {
            $ref = $this->getRef($p);

            return $ref->getDir($p);
        }

        return $this->dir;
    }
185986
protected function produceDependency($alias, $fallback = '_michaels_no_fallback')
    {
        /* Get the registered factory (string, closure, object, container, NoItemFoundMessage) */
        $factory = $this->getIfExists("$alias");

        /* Manage not founds and fallback */
        if ($factory instanceof NoItemFoundMessage) {
            if ($fallback !== '_michaels_no_fallback') {
                return $fallback;
            } elseif (class_exists($alias)) {
                return new $alias;
            } else {
                throw new ItemNotFoundException("$alias not found");
            }
        }

        /* Get any declared dependencies */
        $declared = $this->getIfExists("_declarations.$alias");
        $dependencies = [];

        // Now setup those dependencies into an array
        if (!$declared instanceof NoItemFoundMessage) {
            $dependencies = array_map(function(&$value) use ($alias) {
                if (is_string($value) && $this->exists("$alias")) {
                    return $this->get($value);
                }
                return $value;
            }, $declared);
        }

        /* Produce the object itself */
        if ($factory instanceof IocContainerInterface) {
            $object = $factory->get($alias);

        } elseif (is_string($factory)) {
            $class = new \ReflectionClass($factory);
            $object = $class->newInstanceArgs($dependencies);

        } elseif (is_callable($factory)) {
            array_unshift($dependencies, $this);
            $object = call_user_func_array($factory, $dependencies);

        } elseif (is_object($factory)) {
            $object = $factory;

            if (method_exists($object, "needs")) {
                call_user_func_array([$object, 'needs'], $dependencies);
            }

        } else {
            throw new \Exception("`get()` can only return from strings, callables, or objects");
        }

        /* Run the object through the pipeline, if desired */
        $pipeline = $this->getIfExists("_pipelines.$alias");

        if (!$pipeline instanceof NoItemFoundMessage) {
            /** @var \Closure $pipeline */
            $object = $pipeline($object, $this);
        }

        /* Return the final object */
        return $object;
    }
1182209
public function main()
    {
        if ($this->name !== null) {
            if ($this->value === null && $this->reference === null) {
                throw new BuildException(
                    "You must specify value or refid with the name attribute",
                    $this->getLocation()
                );
            }
        } else {
            if ($this->file === null && $this->env === null) {
                throw new BuildException(
                    "You must specify file or environment when not using the name attribute",
                    $this->getLocation()
                );
            }
        }

        if ($this->file === null && $this->prefix !== null) {
            throw new BuildException("Prefix is only valid when loading from a file.", $this->getLocation());
        }

        if (($this->name !== null) && ($this->value !== null)) {
            $this->addProperty($this->name, $this->value);
        }

        if ($this->file !== null) {
            $this->loadFile($this->file);
        }

        if ($this->env !== null) {
            $this->loadEnvironment($this->env);
        }

        if (($this->name !== null) && ($this->reference !== null)) {
            // get the refereced property
            try {
                $referencedObject = $this->reference->getReferencedObject($this->project);

                if ($referencedObject instanceof Exception) {
                    $reference = $referencedObject->getMessage();
                } else {
                    $reference = (string) $referencedObject;
                }

                $this->addProperty($this->name, $reference);
            } catch (BuildException $be) {
                if ($this->fallback !== null) {
                    $referencedObject = $this->reference->getReferencedObject($this->fallback);

                    if ($referencedObject instanceof Exception) {
                        $reference = $referencedObject->getMessage();
                    } else {
                        $reference = (string) $referencedObject;
                    }
                    $this->addProperty($this->name, $reference);
                } else {
                    throw $be;
                }
            }
        }
    }
116867
protected function getProjectStructureXml($project, $ref = null)
    {
        if(!$project instanceof Project){
            $project = $this->codex->projects->get($project);
        }

        $ref = $ref === null ? $project->refs->getDefaultName() : $ref;

        $xmlPath = path_join($ref, $project->config('phpdoc.xml_path'));
        return $project->getFiles()->get($xmlPath);
    }
787482
public function translate($language = null, $fallback = true)
    {
        if ($this->relationLoaded('translations')) {
            $this->load('translations');
        }

        return (new Translator($this))->translate($language, $fallback);
    }
490639
protected function _locate(ObjectIdentifier $identifier, $fallback = true)
    {
        $class = $this->__registry->getClass($identifier);

        //If the class is FALSE we have tried to locate it already, do not locate it again.
        if(empty($class) && ($class !== false))
        {
            $class = $this->_locators[$identifier->getType()]->locate($identifier, $fallback);

            //If we are falling back set the class in the registry
            if($fallback)
            {
                if(!$this->__registry->get($identifier) instanceof ObjectInterface) {
                    $this->__registry->setClass($identifier, $class);
                }
            }
        }

        return $class;
    }
549900
public function getReferenceRepository()
    {
        if ( ! $this->referenceRepository) {
            $this->referenceRepository = new ProxyReferenceRepository($this->entityManager);
        }

        return $this->referenceRepository;
    }
584691
public function getTranslation($locale = null, $withFallback = null)
    {
        $configFallbackLocale = $this->getFallbackLocale();
        $locale = $locale ?: $this->locale();
        $withFallback = $withFallback === null ? $this->useFallback() : $withFallback;
        $fallbackLocale = $this->getFallbackLocale($locale);

        if ($translation = $this->getTranslationByLocaleKey($locale)) {
            return $translation;
        }
        if ($withFallback && $fallbackLocale) {
            if ($translation = $this->getTranslationByLocaleKey($fallbackLocale)) {
                return $translation;
            }
            if ($fallbackLocale !== $configFallbackLocale && $translation = $this->getTranslationByLocaleKey($configFallbackLocale)) {
                return $translation;
            }
        }

        return null;
    }
242000
public function getLabelMeta($property = null, $fallbackValue = "")
    {
        if (is_null($property)) {
            $varReturn = $this->__labelmeta;
        } elseif (isset($this->__labelmeta[$property])
            && !is_null($this->__labelmeta[$property])
        ) {
            $varReturn = $this->__labelmeta[$property];
        } else {
            $varReturn = $fallbackValue;
        }

        return $varReturn;
    }
1367371
public function forLocale($locale, $fallbacks = null)
    {
        $fork = new static(
            $this->coreFormatter,
            $this->extractor,
            $this->typeProvider,
            $this->textProvider,
            $this->_extensions
        );

        if ($fallbacks) {
            $fork->setFallbacks((array)$fallbacks);
        }

        return $fork->setLocale($locale);
    }