src/foundation/dependency-injection/Container.php
public function get($key) {
		// If the key is in factories the return new instance of class
		if (isset($this->factories[$key])) {
			return $this->factories[$key]();
		}

		// If the key is not in instances
		if (!isset($this->instances[$key])) {
			// If the key is in registry, instanciate the corresponding class and add it in instances
			if (isset($this->registry[$key])) {
				$this->instances[$key] = $this->registry[$key]();
			} else {
				// If the key is not in registry, instanciate the corresponding class and add it in instances
				$this->instances[$key] = self::newInstance($key);
			}
		}

		return $this->instances[$key];
	}
public function get($key) {
		// If the key is in factories the return new instance of class
		if (isset($this->factories[$key])) {
			return $this->factories[$key]();
		}

		// If the key is not in instances
		if (!isset($this->instances[$key])) {
			// If the key is in registry, instanciate the corresponding class and add it in instances
			if (isset($this->registry[$key])) {
				$this->instances[$key] = $this->registry[$key]();
			} else {
				// If the key is not in registry, instanciate the corresponding class and add it in instances
				$this->instances[$key] = self::newInstance($key);
			}
		}

		return $this->instances[$key];
	}
public function get ( $ key ) { // If the key is in factories the return new instance of class if ( isset ( $ this -> factories [ $ key ] ) ) { return $ this -> factories [ $ key ] ( ) ; } // If the key is not in instances if ( ! isset ( $ this -> instances [ $ key ] ) ) { // If the key is in registry, instanciate the corresponding class and add it in instances if ( isset ( $ this -> registry [ $ key ] ) ) { $ this -> instances [ $ key ] = $ this -> registry [ $ key ] ( ) ; } else { // If the key is not in registry, instanciate the corresponding class and add it in instances $ this -> instances [ $ key ] = self :: newInstance ( $ key ) ; } } return $ this -> instances [ $ key ] ; }
Get an entry by key

@param string $key Key of entry

@return Callable|Object
Get an entry by key