Singletons

@param string $id
@return mixed
554206
public function get($id)
  {
    if (isset($this->instances[$id])) return $this->instances[$id];
    if (isset($this->callables[$id]))
    {
      $item = call_user_func($this->callables[$id],$this);
      return $this->instances[$id] = $item;
    }
    throw new \InvalidArgumentException(sprintf('Identifier "%s" is not defined for get.', $id));
  }
89718
public static function getInstance($id)
    {
        $instance = NULL;
        if (array_key_exists($id, self::$_instances))
        {
            $instance = self::$_instances[$id];
        }
        else
        {
            $instance = self::$_current_instance;
        }

        if (is_null($instance))
        {
            throw new \Exception('No instance found for datatable, you should set a datatable id in your
            action with "setDatatableId" using the id from your view ');
        }

        return $instance;
    }
564797
public function getInstance($id)
    {
        if (!\in_array($id, $this->adminServiceIds, true)) {
            $msg = sprintf('Admin service "%s" not found in admin pool.', $id);
            $shortest = -1;
            $closest = null;
            $alternatives = [];
            foreach ($this->adminServiceIds as $adminServiceId) {
                $lev = levenshtein($id, $adminServiceId);
                if ($lev <= $shortest || $shortest < 0) {
                    $closest = $adminServiceId;
                    $shortest = $lev;
                }
                if ($lev <= \strlen($adminServiceId) / 3 || false !== strpos($adminServiceId, $id)) {
                    $alternatives[$adminServiceId] = $lev;
                }
            }
            if (null !== $closest) {
                asort($alternatives);
                unset($alternatives[$closest]);
                $msg = sprintf(
                    'Admin service "%s" not found in admin pool. Did you mean "%s" or one of those: [%s]?',
                    $id,
                    $closest,
                    implode(', ', array_keys($alternatives))
                );
            }
            throw new \InvalidArgumentException($msg);
        }

        $admin = $this->container->get($id);

        if (!$admin instanceof AdminInterface) {
            throw new InvalidArgumentException(sprintf('Found service "%s" is not a valid admin service', $id));
        }

        return $admin;
    }
544725
public function forForeignID($id)
    {
        $singleton = DataObject::singleton($this->baseClass);
        /** @var Relation $relation */
        $relation = $singleton->{$this->relationName}($id);
        return $relation;
    }
326723
public function getObjectById($id)
    {
        if (isset($this->objects[$id])) {
            return $this->objects[$id];
        } else {
            return null;
        }
    }
807478
protected static function getCache($id)
    {
        $type = static::getType();

        $id = (string)$id;

        static::initializeCache($type);

        $collection = self::$cache->{$type};

        if (!property_exists($collection, $id)) {
            return null;
        }

        $resource = $collection->{$id};

        return (clone $resource);
    }
1124850
public function getById($id)
    {
        $list = $this->getByCriteria($id, $this->getUniqueId());
        return reset($list);
    }
1370685
public function get($id = null) {
		if (empty($id)) {
			return false;
		}

		$fields = [
			$this->alias . '.id',
			$this->alias . '.value',
		];
		$blockExists = $this->hasField('block');
		if ($blockExists) {
			$fields[] = $this->alias . '.block';
		}
		$conditions = [$this->alias . '.id' => $id];
		$this->recursive = -1;

		return $this->find('first', compact('fields', 'conditions'));
	}
1012069
public function client($id)
    {
        if (isset($this->clients[$id])) {
            return $this->clients[$id];
        }

        return new Client($this, $id);
    }
1134220
public function peek(string $id)
    {
        if (!isset($this->registered[$id])){
            return null;
        }
        return isset($this->instances[$id]) ? $this->instances[$id] : null;
    }
119126
public function onceUsingId($id)
    {
        $user = $this->provider->retrieveById($id);

        $this->setUser($user);

        return ($user instanceof UserInterface);
    }
733805
public static function firstOrNew($id)
    {
        if ($entity = self::getDataMapperInstance()->first($id)) {
            return $entity;
        }

        $entity = new static();
        $entity->_id = $id;

        return $entity;
    }
217792
public function getRecord($id) {
        $className='Snippet';
        if($className && $id instanceof $className) {
            return $id;
        }else if($id=='root') {
            return singleton($className);
        }else if(is_numeric($id)) {
            return DataObject::get_by_id($className, $id);
        }else {
            return false;
        }
    }
1107000
public function getById($id)
    {
        if ($this->id == $id) return $this;

        return $this->children->getById($id);
    }
1325216
public function findOneById($id)
    {
        $id = $this->idToMongo($id);

        if ($this->identityMap->has($id)) {
            return $this->identityMap->get($id);
        }

        return $this->createQuery(array('_id' => $id))->one();
    }
1284062
protected function isSingelton($id)
    {
        return (isset($this->binds[$id]['singleton']) && $this->binds[$id]['singleton'] === true);
    }
674985
public function get($id)
    {
        if(!isset($this->loadedServices[$id]))
            $this->loadedServices[$id] = parent::get($id);

        return $this->loadedServices[$id];
    }