for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* @author : Jagepard <[email protected]">
* @license https://mit-license.org/ MIT
*/
namespace Rudra\Container\Traits;
trait InstantiationsTrait
{
private array $containers = [];
private array $services = [];
* Creates a container instance
* ----------------------------
* Создает экземпляр контейнера
*
* @param string $name
* @param string $instance
* @param array $data
* @return void
private function containerize(string $name, string $instance, $data = [])
if (!array_key_exists($name, $this->containers)) {
$this->containers[$name] = new $instance($data);
}
return $this->containers[$name];
* Initializes the service
* -----------------------
* Иницианализирует сервис
* @param string|null $instance
private function init(string $name, string $instance = null, $data = [])
$instance ??= $name;
if (!array_key_exists($name, $this->services)) {
$this->set([$name, [$instance, $data]]);
set()
If this is a false-positive, you can also ignore this issue in your code via the ignore-call annotation
ignore-call
$this->/** @scrutinizer ignore-call */
set([$name, [$instance, $data]]);
return $this->get($instance);
get()
return $this->/** @scrutinizer ignore-call */ get($instance);