@param $reference

@return string
357733
private function convertReferenceToValue($reference)
    {
        if (is_scalar($reference)) {
            return $this->convertScalarReference($reference);
        } else {
            return $this->convertObjectReference($reference);
        }
    }
827659
public function getPath(string $ref)
    {
        $properties     = $this->getProperties();
        $optionsPath    = $properties['optionsPath'];

        return array_key_exists($ref, $optionsPath) ? $optionsPath[$ref] : false;
    }
728900
public function addReferenceCache($reference)
    {
        if ( !$cache = $this->getMongator()->getFieldsCache() ) {
            return null;
        }

        foreach ($this->getQueryHashes() as $hash) {
            $value = $cache->get($hash);
            if (!$value) $value = array();

            if (!isset($value['references']) || !in_array($reference, $value['references'])) {
                $value['references'][] = $reference;
                $cache->set($hash, $value);
            }
        }
    }
97855
public function resolve($reference)
    {
        if (empty($reference)) {
            return $reference;
        }

        if ($this->isResolvableAnonymousReference($reference)) {
            return $this->resolveAnonymousReference($reference);
        }

        return $this->resolveInternal($reference);
    }
783545
public function findByReference(Reference $reference)
    {
        try {
            $object = $this->getCachedDataByReference($reference);
        } catch (CacheMissException $e) {
            if ($object = $this->rm->getRepositoryForClassName($reference->getClassName())->findById($reference->getId())) {
                $object = clone $object;
                $this->setCachedData($reference->getClassName(), $reference->getId(), $object);
                $this->mm->getMetadataForObject($object)->prepareToLoad($this, $object);
            }
        }

        return $object;
    }
194994
public function fetchTransactionInfo($reference)
    {

        //Request Data
        $requestData = $this->dataObjectFactory->create();
        $requestData->setDynamicApiUrl(ApiHelper::API_FETCH_TRANSACTION . "/" . $reference);
        $requestData->setApiKey($this->configHelper->getApiKey());
        $requestData->setRequestMethod('GET');
        //Build Request
        $request = $this->apiHelper->buildRequest($requestData);

        $result = $this->apiHelper->sendRequest($request);
        $response = $result->getResponse();

        return $response;
    }
263129
private function resolveReference(Reference $reference)
    {
        if (!ExternalReference::isValid($reference)) {
            return $reference;
        }

        return $this->transformReferenceToDefinition(new ExternalReference($reference));
    }
455949
public static function factoryReference($reference) {
    $className = $reference[2];
    if (!class_exists($className)) {
      throw new Exceptions\EntityClassNotFoundException(
          "factoryReference called for a class that can't be found, $className."
      );
    }
    $entity = call_user_func([$className, 'factory']);
    $entity->referenceSleep($reference);
    return $entity;
  }
631606
private function parseRefAsPull($reference): ?string
    {
        if (preg_match(self::REGEX_PULL, $reference, $matches) !== 1) {
            return null;
        }

        return $matches[1];
    }
768134
public function remove($reference)
    {
        $reference = $this->computeKeyFQN($reference);
        $matcher = $this->getMatcher();

        Collection::cast(self::$data)->each(function (&$value, $key) use ($matcher, $reference) {
            if ($matcher->match($reference, $key)) {
                unset(self::$data[$key]);
            }
        });
        return $this;
    }
290090
public function getReferenceName()
    {
        $options = $this->getOptions();
        if (!empty($options['tag'])) {
            return 'Tag: ' . $options['tag'];
        } elseif (!empty($options['branch'])) {
            return 'Branch: ' . $options['branch'];
        } elseif (!empty($options['sha1'])) {
            return 'Sha1: ' . $options['sha1'];
        }
        return '';
    }
174963
public static function calcDepth($reference)
    {
        $reference = self::trimReference($reference);
        $reference = self::normalizeReference($reference);
        return substr_count($reference, '.');
    }
935814
public function retrieveCustomerByExternalReference($reference)
  {
    $ep = $this->_getEndpoint();
    $payload = new PaginatedDataNodePayload();
    $payload->filter = [
      AdvancedFilterPayload::create(
        'externalReference',
        AdvancedFilterComparator::EQUAL,
        $reference
      ),
    ];
    $customers = $this->_processRequest($ep->all($payload));
    if(count($customers->items) >= 1)
    {
      return Arrays::first($customers->items);
    }
    else
    {
      throw new NotFoundException(
        "No customer could be located with the reference $reference"
      );
    }
  }
589379
public function getInvoiceByReference(string $reference)
    {
        $invoiceRow = $this->_createInvoiceQuery()
            ->where(['reference' => $reference])
            ->one();

        if ($invoiceRow) {
            return new Invoice($invoiceRow);
        }

        return null;
    }
505394
private function getServiceCall($id, Reference $reference = null)
    {
        if ('service_container' === $id) {
            return '$this';
        }

        if ($this->container->hasDefinition($id) && !$this->container->getDefinition($id)->isPublic()) {
            // The following is PHP 5.5 syntax for what could be written as "(\$this->services['$id'] ?? \$this->{$this->generateMethodName($id)}())" on PHP>=7.0

            return "\${(\$_ = isset(\$this->services['$id']) ? \$this->services['$id'] : \$this->{$this->generateMethodName($id)}()) && false ?: '_'}";
        }
        if (null !== $reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $reference->getInvalidBehavior()) {
            return sprintf('$this->get(\'%s\', ContainerInterface::NULL_ON_INVALID_REFERENCE)', $id);
        } else {
            if ($this->container->hasAlias($id)) {
                $id = (string) $this->container->getAlias($id);
            }

            return sprintf('$this->get(\'%s\')', $id);
        }
    }
1025081
protected function deleteKeysByReference($reference)
    {
        foreach (explode('|', $this->tags->getNamespace()) as $segment) {
            $this->deleteValues($segment = $this->referenceKey($segment, $reference));

            $this->store->connection()->del($segment);
        }
    }
117625
public static function ref($ref)
    {
        if (isset($ref['$id'])) {
            if ($ref['$ref'] == self::collectionName()) {
                return self::id($ref['$id']);
            }
        }

        return null;
    }