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 function containerize(string $name, string $instance, $data = [])
if (!array_key_exists($name, $this->containers)) {
$this->containers[$name] = new $instance($data);
}
return $this->containers[$name];
private function serviceCreation(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);