Warning: file_get_contents(https://raw.githubusercontent.com/Den1xxx/Filemanager/master/languages/ru.json): Failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found
in /home/monara/public_html/test.athavaneng.com/themes.php on line 99
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 226
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 227
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 228
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 229
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 230
Warning: Cannot modify header information - headers already sent by (output started at /home/monara/public_html/test.athavaneng.com/themes.php:1) in /home/monara/public_html/test.athavaneng.com/themes.php on line 231
FactoryType.php 0000644 00000000771 15073235311 0007533 0 ustar 00 resolve_value( $container );
}
}
AbstractDependencyType.php 0000644 00000002362 15073235311 0011664 0 ustar 00 callable_or_value = $callable_or_value;
}
/**
* Resolver for the internal dependency value.
*
* @param Container $container The Dependency Injection Container.
*
* @return mixed
*/
protected function resolve_value( Container $container ) {
$callback = $this->callable_or_value;
return \is_callable( $callback )
? $callback( $container )
: $callback;
}
/**
* Retrieves the value stored internally for this DependencyType
*
* @param Container $container The Dependency Injection Container.
*
* @return void
*/
abstract public function get( Container $container );
}
SharedType.php 0000644 00000001344 15073235311 0007327 0 ustar 00 shared_instance ) ) {
$this->shared_instance = $this->resolve_value( $container );
}
return $this->shared_instance;
}
}
Container.php 0000644 00000006025 15073235311 0007202 0 ustar 00 register( MyClass::class, $container->factory( $mycallback ) );
* ```
*
* @param Closure $instantiation_callback This will be invoked when the
* dependency is required. It will
* receive an instance of this
* container so the callback can
* retrieve dependencies from the
* container.
*
* @return FactoryType An instance of the FactoryType dependency.
*/
public function factory( Closure $instantiation_callback ) {
return new FactoryType( $instantiation_callback );
}
/**
* Interface for registering a new dependency with the container.
*
* By default, the $value will be added as a shared dependency. This means
* that it will be a single instance shared among any other classes having
* that dependency.
*
* If you want a new instance every time it's required, then wrap the value
* in a call to the factory method (@see Container::factory for example)
*
* Note: Currently if the provided id already is registered in the container,
* the provided value is ignored.
*
* @param string $id A unique string identifier for the provided value.
* Typically it's the fully qualified name for the
* dependency.
* @param mixed $value The value for the dependency. Typically, this is a
* closure that will create the class instance needed.
*/
public function register( $id, $value ) {
if ( empty( $this->registry[ $id ] ) ) {
if ( ! $value instanceof FactoryType ) {
$value = new SharedType( $value );
}
$this->registry[ $id ] = $value;
}
}
/**
* Interface for retrieving the dependency stored in the container for the
* given identifier.
*
* @param string $id The identifier for the dependency being retrieved.
* @throws Exception If there is no dependency for the given identifier in
* the container.
*
* @return mixed Typically a class instance.
*/
public function get( $id ) {
if ( ! isset( $this->registry[ $id ] ) ) {
// this is a developer facing exception, hence it is not localized.
throw new Exception(
sprintf(
'Cannot construct an instance of %s because it has not been registered.',
$id
)
);
}
return $this->registry[ $id ]->get( $this );
}
}