diff --git a/docs.md b/docs.md index b071099..ea63210 100644 --- a/docs.md +++ b/docs.md @@ -17,7 +17,11 @@ - [Rudra\Container\Traits\FacadeTrait](#rudra_container_traits_facadetrait) - [Rudra\Container\Traits\InstantiationsTrait](#rudra_container_traits_instantiationstrait) - [Rudra\Container\Traits\SetRudraContainersTrait](#rudra_container_traits_setrudracontainerstrait) -
+ + +--- + + @@ -25,7 +29,7 @@ | Visibility | Function | |:-----------|:---------| | public | `__construct(array $data)`
| -| public | `get(string $id): ?mixed`
| +| public | `get(string $id): mixed`
| | public | `all(): array`
| | public | `set(array $data): void`
| | public | `has(string $id): bool`
| @@ -36,12 +40,11 @@ ### Class: Rudra\Container\Cookie | Visibility | Function | |:-----------|:---------| -| public | `get(string $id): ?mixed`
| +| public | `get(string $id): mixed`
| | public | `has(string $id): bool`
| -| public | `unset(string $id): void`
| +| public | `remove(string $id): void`
| | private | `deleteCookie(string $id): void`
| -| public | `set(array $data): void`
| -| private | `processCookieData(array $data): void`
| +| public | `set(string $key, string $value, int $expire, string $path, ?string $domain, bool $secure, bool $httponly, string $samesite): void`
| @@ -49,7 +52,7 @@ ### Class: Rudra\Container\Facades\Cookie | Visibility | Function | |:-----------|:---------| -| public static | `__callStatic(string $method, array $parameters): ?mixed`
Handles static method calls for the Facade class.
It dynamically resolves the underlying class name by removing "Facade" from the class name.
If the resolved class does not exist, it attempts to clean up the class name by removing spaces.
If the resolved class is not already registered in the container, it registers it.
Finally, it delegates the static method call to the resolved class instance.
-------------------------
Обрабатывает статические вызовы методов для класса Facade.
Динамически разрешает имя базового класса, удаляя "Facade" из имени класса.
Если разрешённый класс не существует, пытается очистить имя класса, удаляя пробелы.
Если разрешённый класс ещё не зарегистрирован в контейнере, он регистрируется.
В конце делегирует статический вызов метода экземпляру разрешённого класса. | +| public static | `__callStatic(string $method, array $parameters): mixed`
Handles static method calls for the Facade class
It dynamically resolves the underlying class name by removing "Facade" from the class name
If the resolved class does not exist, it attempts to clean up the class name by removing spaces
If the resolved class is not already registered in the container, it registers it
Finally, it delegates the static method call to the resolved class instance | @@ -57,7 +60,7 @@ ### Class: Rudra\Container\Facades\Request | Visibility | Function | |:-----------|:---------| -| public static | `__callStatic(string $method, array $parameters): ?mixed`
Handles static method calls for the Facade class.
It dynamically resolves the underlying class name by removing "Facade" from the class name.
If the resolved class does not exist, it attempts to clean up the class name by removing spaces.
If the resolved class is not already registered in the container, it registers it.
Finally, it delegates the static method call to the resolved class instance.
-------------------------
Обрабатывает статические вызовы методов для класса Facade.
Динамически разрешает имя базового класса, удаляя "Facade" из имени класса.
Если разрешённый класс не существует, пытается очистить имя класса, удаляя пробелы.
Если разрешённый класс ещё не зарегистрирован в контейнере, он регистрируется.
В конце делегирует статический вызов метода экземпляру разрешённого класса. | +| public static | `__callStatic(string $method, array $parameters): mixed`
Handles static method calls for the Facade class
It dynamically resolves the underlying class name by removing "Facade" from the class name
If the resolved class does not exist, it attempts to clean up the class name by removing spaces
If the resolved class is not already registered in the container, it registers it
Finally, it delegates the static method call to the resolved class instance | @@ -65,7 +68,7 @@ ### Class: Rudra\Container\Facades\Response | Visibility | Function | |:-----------|:---------| -| public static | `__callStatic(string $method, array $parameters): ?mixed`
Handles static method calls for the Facade class.
It dynamically resolves the underlying class name by removing "Facade" from the class name.
If the resolved class does not exist, it attempts to clean up the class name by removing spaces.
If the resolved class is not already registered in the container, it registers it.
Finally, it delegates the static method call to the resolved class instance.
-------------------------
Обрабатывает статические вызовы методов для класса Facade.
Динамически разрешает имя базового класса, удаляя "Facade" из имени класса.
Если разрешённый класс не существует, пытается очистить имя класса, удаляя пробелы.
Если разрешённый класс ещё не зарегистрирован в контейнере, он регистрируется.
В конце делегирует статический вызов метода экземпляру разрешённого класса. | +| public static | `__callStatic(string $method, array $parameters): mixed`
Handles static method calls for the Facade class
It dynamically resolves the underlying class name by removing "Facade" from the class name
If the resolved class does not exist, it attempts to clean up the class name by removing spaces
If the resolved class is not already registered in the container, it registers it
Finally, it delegates the static method call to the resolved class instance | @@ -73,7 +76,7 @@ ### Class: Rudra\Container\Facades\Rudra | Visibility | Function | |:-----------|:---------| -| public static | `__callStatic( $method, array $parameters)`
| +| public static | `__callStatic($method, array $parameters)`
| @@ -81,7 +84,7 @@ ### Class: Rudra\Container\Facades\Session | Visibility | Function | |:-----------|:---------| -| public static | `__callStatic(string $method, array $parameters): ?mixed`
Handles static method calls for the Facade class.
It dynamically resolves the underlying class name by removing "Facade" from the class name.
If the resolved class does not exist, it attempts to clean up the class name by removing spaces.
If the resolved class is not already registered in the container, it registers it.
Finally, it delegates the static method call to the resolved class instance.
-------------------------
Обрабатывает статические вызовы методов для класса Facade.
Динамически разрешает имя базового класса, удаляя "Facade" из имени класса.
Если разрешённый класс не существует, пытается очистить имя класса, удаляя пробелы.
Если разрешённый класс ещё не зарегистрирован в контейнере, он регистрируется.
В конце делегирует статический вызов метода экземпляру разрешённого класса. | +| public static | `__callStatic(string $method, array $parameters): mixed`
Handles static method calls for the Facade class
It dynamically resolves the underlying class name by removing "Facade" from the class name
If the resolved class does not exist, it attempts to clean up the class name by removing spaces
If the resolved class is not already registered in the container, it registers it
Finally, it delegates the static method call to the resolved class instance | @@ -119,7 +122,7 @@ ### Class: Rudra\Container\Interfaces\RudraInterface | Visibility | Function | |:-----------|:---------| -| abstract public static | `run(): Rudra\Container\Interfaces\RudraInterface`
Implements the Singleton pattern to ensure only one instance of the class is created.
If the instance does not exist, it creates and stores it. Otherwise, it returns the existing instance.
-------------------------
Реализует паттерн Singleton, чтобы гарантировать создание только одного экземпляра класса.
Если экземпляр не существует, он создаётся и сохраняется. В противном случае возвращается существующий экземпляр. | +| abstract public static | `run(): Rudra\Container\Interfaces\RudraInterface`
| @@ -134,8 +137,8 @@ | public | `delete(): Psr\Container\ContainerInterface`
| | public | `server(): Psr\Container\ContainerInterface`
| | public | `files(): Psr\Container\ContainerInterface`
| -| private | `containerize(string $name, string $instance, array $data): Psr\Container\ContainerInterface`
Creates and stores a container instance if it does not already exist.
If the container for the given name does not exist in the `containers` array,
it creates a new instance of the specified class with the provided data and stores it.
Otherwise, it returns the existing container instance.
-------------------------
Создаёт и сохраняет экземпляр контейнера, если он ещё не существует.
Если контейнер с указанным именем отсутствует в массиве `containers`,
создаётся новый экземпляр указанного класса с предоставленными данными и сохраняется.
В противном случае возвращается существующий экземпляр контейнера. | -| private | `init(string $name, ?string $instance, array $data): ?mixed`
Initializes and retrieves an instance of a class or service.
If the instance is not already registered in the container, it registers it with the provided data.
The method uses the class name as the default instance if no specific instance is provided.
-------------------------
Инициализирует и извлекает экземпляр класса или сервиса.
Если экземпляр ещё не зарегистрирован в контейнере, он регистрируется с предоставленными данными.
Метод использует имя класса в качестве экземпляра по умолчанию, если конкретный экземпляр не указан. | +| private | `containerize(string $name, string $instance, array $data): Psr\Container\ContainerInterface`
Creates and stores a container instance if it does not already exist
If the container for the given name does not exist in the `containers` array,
it creates a new instance of the specified class with the provided data and stores it
Otherwise, it returns the existing container instance | +| private | `init(string $name, ?string $instance, array $data): mixed`
Initializes and retrieves an instance of a class or service
If the instance is not already registered in the container, it registers it with the provided data
The method uses the class name as the default instance if no specific instance is provided | @@ -143,7 +146,7 @@ ### Class: Rudra\Container\Response | Visibility | Function | |:-----------|:---------| -| public | `json(array $data): void`
| +| public | `json(array $data, int $code): void`
| | private | `getJson(array $data): string`
| @@ -152,24 +155,25 @@ ### Class: Rudra\Container\Rudra | Visibility | Function | |:-----------|:---------| -| public | `__call(string $method, array $parameters)`
Handles dynamic method calls for the class.
If the method exists in `allowedContainersMap`, it initializes a container
with the provided data and returns it.
If the method exists in `allowedInstances`, it initializes and returns
the corresponding instance.
If the method is not allowed (not found in either map), it throws a LogicException.
-------------------------
Обрабатывает динамические вызовы методов для класса.
Если метод существует в `allowedContainersMap`, инициализирует контейнер
с предоставленными данными и возвращает его.
Если метод существует в `allowedInstances`, инициализирует и возвращает
соответствующий экземпляр.
Если метод не разрешён (не найден ни в одной из карт), выбрасывается исключение LogicException. | -| public | `new(string $object, ?array $params): object`
Creates and returns a new instance of the specified class.
If the class has a constructor with parameters, it resolves and injects them using the provided parameters.
If the class does not exist, it throws a LogicException.
-------------------------
Создаёт и возвращает новый экземпляр указанного класса.
Если у класса есть конструктор с параметрами, разрешает их и внедряет, используя предоставленные параметры.
Если класс не существует, выбрасывается исключение LogicException. | -| public static | `run(): Rudra\Container\Interfaces\RudraInterface`
Implements the Singleton pattern to ensure only one instance of the class is created.
If the instance does not exist, it creates and stores it. Otherwise, it returns the existing instance.
-------------------------
Реализует паттерн Singleton, чтобы гарантировать создание только одного экземпляра класса.
Если экземпляр не существует, он создаётся и сохраняется. В противном случае возвращается существующий экземпляр. | -| public | `get(string $id): ?mixed`
Retrieves a service by its ID from the service container or waiting storage.
If the service exists in the container, it is returned directly.
If the service does not exist, it checks if the service can be resolved from the waiting storage or class name.
If the service cannot be resolved, it throws a NotFoundException.
-------------------------
Извлекает сервис по его идентификатору из контейнера сервисов или хранилища ожидания.
Если сервис существует в контейнере, он возвращается напрямую.
Если сервис не существует, проверяется, может ли он быть разрешён из хранилища ожидания или имени класса.
Если сервис не может быть разрешён, выбрасывается исключение NotFoundException. | -| public | `set(array $data): void`
Sets a value or object in the container, identified by a key.
If the key is not a string, it throws a LogicException.
If the object is an array, it processes the array using `handleArrayObject`.
Otherwise, it resolves and sets the object using `resolveSetValue` and `setObject`.
-------------------------
Устанавливает значение или объект в контейнере, идентифицированный ключом.
Если ключ не является строкой, выбрасывается исключение LogicException.
Если объект является массивом, он обрабатывается с помощью `handleArrayObject`.
В противном случае объект разрешается и устанавливается с помощью `resolveSetValue` и `setObject`. | -| private | `handleArrayObject(string $key, array $object): void`
Handles the processing of an array object during the setting process.
If the array contains more than one element and the first element is not an object,
it processes the array using dependency injection via the `iOc` method.
Otherwise, it resolves and sets the first element as the value for the given key.
-------------------------
Обрабатывает массив объектов во время процесса установки.
Если массив содержит более одного элемента, и первый элемент не является объектом,
он обрабатывает массив с использованием внедрения зависимостей через метод `iOc`.
В противном случае разрешает и устанавливает первый элемент как значение для указанного ключа. | -| private | `resolveSetValue(?mixed $value): ?mixed`
Resolves the value to be set in the container based on its type.
If the value is a Closure, it executes and returns the result.
If the value implements the Factory interface, it creates and returns an instance using the factory's `create` method.
Otherwise, it returns the value as-is.
-------------------------
Разрешает значение, которое должно быть установлено в контейнере, на основе его типа.
Если значение является замыканием (Closure), оно выполняется, и возвращается результат.
Если значение реализует интерфейс Factory, создаётся и возвращается экземпляр с использованием метода `create` фабрики.
В противном случае возвращается значение без изменений. | -| private | `isFactoryImplementation(?mixed $value): bool`
Checks if the given value represents a valid implementation of the FactoryInterface.
The value is considered valid if it is a string, the class exists, and it is a subclass of FactoryInterface.
-------------------------
Проверяет, представляет ли данное значение допустимую реализацию интерфейса FactoryInterface.
Значение считается допустимым, если оно является строкой, класс существует и является подклассом FactoryInterface. | +| public | `__construct()`
| +| public | `__call(string $method, array $parameters): mixed`
Handles dynamic method calls for the class.
If the method exists in `allowedContainersMap`, it initializes a container.
with the provided data and returns it.
If the method exists in `allowedInstances`, it initializes and returns.
the corresponding instance.
If the method is not allowed (not found in either map), it throws a LogicException. | +| public static | `run(): Rudra\Container\Interfaces\RudraInterface`
Implements the Singleton pattern to ensure only one instance of the class is created.
If the instance does not exist, it creates and stores it. Otherwise, it returns the existing instance. | +| public | `get(string $id): mixed`
Retrieves a service by its ID from the service container or waiting storage.
If the service exists in the container, it is returned directly.
If the service does not exist, it checks if the service can be resolved from the waiting storage or class name.
If the service cannot be resolved, it throws a NotFoundException. | +| public | `set(array $data): void`
Sets a value or object in the container, identified by a key.
If the key is not a string, it throws a LogicException.
If the object is an array, it processes the array using `handleArrayObject`.
Otherwise, it resolves and sets the object using `resolveSetValue` and `setObject`. | +| private | `handleArrayObject(string $key, array $object): void`
Handles the processing of an array object during the setting process.
If the array contains more than one element and the first element is not an object,
it processes the array using dependency injection via the `iOc` method.
Otherwise, it resolves and sets the first element as the value for the given key. | +| private | `resolveSetValue(mixed $value): mixed`
Resolves the value to be set in the container based on its type.
If the value is a Closure, it executes and returns the result.
If the value is a string matching the factory naming convention (ends with "Factory") and the class exists,
it instantiates the class and calls its `create()` method.
Otherwise, it returns the value as-is. | +| private | `isFactoryImplementation(mixed $value): bool`
Checks if the given value represents a valid implementation of the FactoryInterface.
The value is considered valid if it is a string, the class exists, and it is a subclass of FactoryInterface. | | public | `has(string $id): bool`
| -| private | `setObject(string $key, object\|string $object): void`
Sets an object or class in the service container.
If the provided value is an object, it is directly stored in the service container.
If the provided value is a string (class name), it resolves and sets the object using the `iOc` method.
-------------------------
Устанавливает объект или класс в контейнере сервисов.
Если предоставленное значение является объектом, он сохраняется напрямую в контейнере сервисов.
Если предоставленное значение является строкой (имя класса), разрешается и устанавливается объект с использованием метода `iOc`. | -| private | `iOc(string $key, string $object, ?array $params): void`
Resolves and sets an object in the service container using dependency injection.
It uses reflection to analyze the constructor of the specified class.
If the constructor has parameters, it resolves them using `getParamsIoC` and creates the instance with the resolved arguments.
If the constructor has no parameters, it creates the instance directly.
The created instance is then stored in the service container with the specified key.
-------------------------
Разрешает и устанавливает объект в контейнере сервисов с использованием внедрения зависимостей.
Использует рефлексию для анализа конструктора указанного класса.
Если конструктор имеет параметры, они разрешаются с помощью `getParamsIoC`, и экземпляр создаётся с использованием разрешённых аргументов.
Если конструктор не имеет параметров, экземпляр создаётся напрямую.
Созданный экземпляр затем сохраняется в контейнере сервисов с указанным ключом. | -| public | `autowire( $object, string $method, ?array $params): ?mixed`
Automatically resolves and invokes a method on the given object using dependency injection.
It uses reflection to analyze the method's parameters and resolves them using `getParamsIoC`.
If the method has no parameters, it is invoked directly. Otherwise, the resolved arguments are passed during invocation.
-------------------------
Автоматически разрешает и вызывает метод у указанного объекта с использованием внедрения зависимостей.
Использует рефлексию для анализа параметров метода и разрешает их с помощью `getParamsIoC`.
Если метод не имеет параметров, он вызывается напрямую. В противном случае разрешённые аргументы передаются при вызове. | -| public | `getParamsIoC(ReflectionMethod $constructor, ?array $params): array`
Resolves and retrieves parameters for dependency injection based on the constructor's reflection.
It processes each parameter of the constructor, resolving dependencies using bindings, class names, or default values.
If a parameter cannot be resolved, it uses the provided `$params` array.
-------------------------
Разрешает и извлекает параметры для внедрения зависимостей на основе рефлексии конструктора.
Обрабатывает каждый параметр конструктора, разрешая зависимости с использованием привязок, имён классов или значений по умолчанию.
Если параметр не может быть разрешён, используется предоставленный массив `$params`. | -| private | `resolveDependency( $className): object`
Resolves a dependency based on the provided class name or object.
If the dependency is a Closure, it executes and returns the result.
If the dependency is a string representing an existing class, it resolves the class using `resolveClass`.
If the dependency is an object, it resolves the object using `resolveObject`.
If the dependency exists in the waiting storage, it retrieves and resolves the service recursively.
Otherwise, it creates and returns a new instance of the class.
-------------------------
Разрешает зависимость на основе предоставленного имени класса или объекта.
Если зависимость является замыканием (Closure), оно выполняется, и возвращается результат.
Если зависимость является строкой, представляющей существующий класс, разрешает класс с помощью `resolveClass`.
Если зависимость является объектом, разрешает объект с помощью `resolveObject`.
Если зависимость существует в хранилище ожидания, извлекает и разрешает сервис рекурсивно.
В противном случае создаётся и возвращается новый экземпляр класса. | -| private | `resolveClass(string $className): object`
Resolves a class by creating an instance of it.
If the class implements or is a subclass of `FactoryInterface`, it creates an instance and calls the `create` method.
Otherwise, it simply creates and returns a new instance of the class.
-------------------------
Разрешает класс, создавая его экземпляр.
Если класс реализует или является подклассом `FactoryInterface`, создаётся экземпляр, и вызывается метод `create`.
В противном случае просто создаётся и возвращается новый экземпляр класса. | -| private | `resolveObject(object $object): object`
Resolves an object by checking if it implements the FactoryInterface.
If the object implements FactoryInterface, it calls the `create` method and returns the result.
Otherwise, it returns the object as-is.
-------------------------
Разрешает объект, проверяя, реализует ли он интерфейс FactoryInterface.
Если объект реализует FactoryInterface, вызывается метод `create`, и возвращается результат.
В противном случае объект возвращается без изменений. | -| private | `containerize(string $name, string $instance, array $data): Psr\Container\ContainerInterface`
Creates and stores a container instance if it does not already exist.
If the container for the given name does not exist in the `containers` array,
it creates a new instance of the specified class with the provided data and stores it.
Otherwise, it returns the existing container instance.
-------------------------
Создаёт и сохраняет экземпляр контейнера, если он ещё не существует.
Если контейнер с указанным именем отсутствует в массиве `containers`,
создаётся новый экземпляр указанного класса с предоставленными данными и сохраняется.
В противном случае возвращается существующий экземпляр контейнера. | -| private | `init(string $name, ?string $instance, array $data): ?mixed`
Initializes and retrieves an instance of a class or service.
If the instance is not already registered in the container, it registers it with the provided data.
The method uses the class name as the default instance if no specific instance is provided.
-------------------------
Инициализирует и извлекает экземпляр класса или сервиса.
Если экземпляр ещё не зарегистрирован в контейнере, он регистрируется с предоставленными данными.
Метод использует имя класса в качестве экземпляра по умолчанию, если конкретный экземпляр не указан. | +| private | `setObject(string $key, object\|string $object): void`
Sets an object or class in the service container.
If the provided value is an object, it is directly stored in the service container.
If the provided value is a string (class name), it resolves and sets the object using the `iOc` method. | +| private | `iOc(string $key, string $object, ?array $params): void`
Resolves and sets an object in the service container using dependency injection.
It uses reflection to analyze the constructor of the specified class.
If the constructor has parameters, it resolves them using `getParamsIoC` and creates the instance with the resolved arguments.
If the constructor has no parameters, it creates the instance directly.
The created instance is then stored in the service container with the specified key. | +| public | `new(string $object, ?array $params): object`
Creates and returns a new instance of the specified class.
If the class has a constructor with parameters, it resolves and injects them using the provided parameters.
If the class does not exist, it throws a LogicException. | +| public | `autowire(object\|string $object, string $method, ?array $params): mixed`
Automatically resolves and invokes a method on the given object using dependency injection.
It uses reflection to analyze the method's parameters and resolves them using `getParamsIoC`.
If the method has no parameters, it is invoked directly. Otherwise, the resolved arguments are passed during invocation. | +| public | `getParamsIoC(ReflectionMethod $constructor, ?array $params): array`
Resolves and retrieves parameters for dependency injection based on the constructor's reflection.
It processes each parameter of the constructor, resolving dependencies using bindings, class names, or default values. | +| private | `resolveDependency($className): object`
Resolves a dependency based on the provided class name or object.
If the dependency is a Closure, it executes and returns the result.
If the dependency is an object, it resolves the object using `resolveObject`.
If the dependency exists in the waiting storage, it retrieves and resolves the service recursively.
If the dependency is a string representing an existing class, it resolves the class using `resolveClass`.
Otherwise, it creates and returns a new instance of the class. | +| private | `resolveClass(string $className): object`
Resolves a class by creating an instance of it.
If the class implements or is a subclass of `FactoryInterface`, it creates an instance and calls the `create` method.
Otherwise, it simply creates and returns a new instance of the class. | +| private | `resolveObject(object $object): object`
Resolves an object by checking if it implements the FactoryInterface.
If the object implements FactoryInterface, it calls the `create` method and returns the result.
Otherwise, it returns the object as-is. | +| private | `containerize(string $name, string $instance, array $data): Psr\Container\ContainerInterface`
Creates and stores a container instance if it does not already exist
If the container for the given name does not exist in the `containers` array,
it creates a new instance of the specified class with the provided data and stores it
Otherwise, it returns the existing container instance | +| private | `init(string $name, ?string $instance, array $data): mixed`
Initializes and retrieves an instance of a class or service
If the instance is not already registered in the container, it registers it with the provided data
The method uses the class name as the default instance if no specific instance is provided | @@ -177,12 +181,10 @@ ### Class: Rudra\Container\Session | Visibility | Function | |:-----------|:---------| -| public | `get(string $id): ?mixed`
| -| public | `set(array $data): void`
| -| private | `processSessionData(array $data): void`
Processes session data by merging or setting values.
If the key already exists and is an array, merges the new data.
Otherwise, sets the new value directly.
-------------------------
Обрабатывает данные сессии, объединяя или устанавливая значения.
Если ключ уже существует и является массивом, объединяет новые данные.
В противном случае устанавливает новое значение напрямую. | +| public | `get(string $id): mixed`
| +| public | `set(string $key, mixed $value): void`
| | public | `has(string $id): bool`
| -| public | `unset(string $key): void`
| -| public | `setFlash(string $type, array $data): void`
Sets flash messages in the session.
Iterates through the provided data and sets each key-value pair as session data.
-------------------------
Устанавливает флеш-сообщения в сессии.
Перебирает предоставленные данные и устанавливает каждую пару ключ-значение как данные сессии. | +| public | `remove(string $key): void`
| | public | `start(): void`
| | public | `stop(): void`
| | public | `clear(): void`
| @@ -193,7 +195,7 @@ ### Class: Rudra\Container\Traits\FacadeTrait | Visibility | Function | |:-----------|:---------| -| public static | `__callStatic(string $method, array $parameters): ?mixed`
Handles static method calls for the Facade class.
It dynamically resolves the underlying class name by removing "Facade" from the class name.
If the resolved class does not exist, it attempts to clean up the class name by removing spaces.
If the resolved class is not already registered in the container, it registers it.
Finally, it delegates the static method call to the resolved class instance.
-------------------------
Обрабатывает статические вызовы методов для класса Facade.
Динамически разрешает имя базового класса, удаляя "Facade" из имени класса.
Если разрешённый класс не существует, пытается очистить имя класса, удаляя пробелы.
Если разрешённый класс ещё не зарегистрирован в контейнере, он регистрируется.
В конце делегирует статический вызов метода экземпляру разрешённого класса. | +| public static | `__callStatic(string $method, array $parameters): mixed`
Handles static method calls for the Facade class
It dynamically resolves the underlying class name by removing "Facade" from the class name
If the resolved class does not exist, it attempts to clean up the class name by removing spaces
If the resolved class is not already registered in the container, it registers it
Finally, it delegates the static method call to the resolved class instance | @@ -201,8 +203,8 @@ ### Class: Rudra\Container\Traits\InstantiationsTrait | Visibility | Function | |:-----------|:---------| -| private | `containerize(string $name, string $instance, array $data): Psr\Container\ContainerInterface`
Creates and stores a container instance if it does not already exist.
If the container for the given name does not exist in the `containers` array,
it creates a new instance of the specified class with the provided data and stores it.
Otherwise, it returns the existing container instance.
-------------------------
Создаёт и сохраняет экземпляр контейнера, если он ещё не существует.
Если контейнер с указанным именем отсутствует в массиве `containers`,
создаётся новый экземпляр указанного класса с предоставленными данными и сохраняется.
В противном случае возвращается существующий экземпляр контейнера. | -| private | `init(string $name, ?string $instance, array $data): ?mixed`
Initializes and retrieves an instance of a class or service.
If the instance is not already registered in the container, it registers it with the provided data.
The method uses the class name as the default instance if no specific instance is provided.
-------------------------
Инициализирует и извлекает экземпляр класса или сервиса.
Если экземпляр ещё не зарегистрирован в контейнере, он регистрируется с предоставленными данными.
Метод использует имя класса в качестве экземпляра по умолчанию, если конкретный экземпляр не указан. | +| private | `containerize(string $name, string $instance, array $data): Psr\Container\ContainerInterface`
Creates and stores a container instance if it does not already exist
If the container for the given name does not exist in the `containers` array,
it creates a new instance of the specified class with the provided data and stores it
Otherwise, it returns the existing container instance | +| private | `init(string $name, ?string $instance, array $data): mixed`
Initializes and retrieves an instance of a class or service
If the instance is not already registered in the container, it registers it with the provided data
The method uses the class name as the default instance if no specific instance is provided | @@ -212,6 +214,8 @@ |:-----------|:---------| | public | `__construct(Rudra\Container\Interfaces\RudraInterface $rudra)`
| | public | `rudra(): Rudra\Container\Interfaces\RudraInterface`
| -
-###### created with [Rudra-Documentation-Collector](#https://github.com/Jagepard/Rudra-Documentation-Collector) + +--- + +###### created with [Rudra-Documentation-Collector](https://github.com/Jagepard/Rudra-Documentation-Collector) diff --git a/src/Container.php b/src/Container.php index b331223..40ce496 100644 --- a/src/Container.php +++ b/src/Container.php @@ -16,15 +16,8 @@ class Container implements ContainerInterface { - /** - * @param array $data - */ public function __construct(protected array $data = []) {} - /** - * @param string $id - * @return mixed - */ #[\Override] public function get(string $id): mixed { @@ -33,27 +26,16 @@ public function get(string $id): mixed : throw new NotFoundException("Identifier \"$id\" is not found."); } - /** - * @return array - */ public function all(): array { return $this->data; } - /** - * @param array $data - * @return void - */ public function set(array $data): void { $this->data = array_merge($this->data, $data); } - /** - * @param string $id - * @return boolean - */ #[\Override] public function has(string $id): bool { diff --git a/src/Cookie.php b/src/Cookie.php index f0dca3f..fccd5ec 100755 --- a/src/Cookie.php +++ b/src/Cookie.php @@ -15,13 +15,6 @@ class Cookie { - /** - * Возвращает значение куки по ключу. - * - * @param string $id - * @return mixed - * @throws NotFoundException - */ public function get(string $id): mixed { if (!array_key_exists($id, $_COOKIE)) { @@ -30,25 +23,12 @@ public function get(string $id): mixed return $_COOKIE[$id]; } - /** - * Проверяет, существует ли куки. - * - * @param string $id - * @return bool - */ public function has(string $id): bool { return array_key_exists($id, $_COOKIE); } - /** - * Удаляет куки. - * - * @param string $id - * @return void - * @throws NotFoundException - */ - public function remove(string $id): void // Переименовано с unset + public function remove(string $id): void { if (!array_key_exists($id, $_COOKIE)) { throw new NotFoundException("Куки с идентификатором \"$id\" не найдено."); @@ -56,31 +36,12 @@ public function remove(string $id): void // Переименовано с unset $this->deleteCookie($id); } - /** - * Удаляет куки из суперглобального массива и отправляет заголовок для удаления в браузере. - * - * @param string $id - * @return void - */ private function deleteCookie(string $id): void { unset($_COOKIE[$id]); - setcookie($id, '', time() - 3600, '/'); // Установить время в прошлое + setcookie($id, '', time() - 3600, '/'); } - /** - * Устанавливает куки. - * - * @param string $key Имя куки. - * @param string $value Значение куки. - * @param int $expire Время жизни (timestamp). По умолчанию 0 (до закрытия браузера). - * @param string $path Путь на сервере. По умолчанию '/'. - * @param string|null $domain Домен. По умолчанию null (текущий хост). - * @param bool $secure Использовать HTTPS. По умолчанию false. - * @param bool $httponly Запретить доступ через JS. По умолчанию false. - * @param string $samesite Значение SameSite. По умолчанию 'Lax'. - * @return void - */ public function set( string $key, string $value, @@ -93,7 +54,7 @@ public function set( ): void { $_COOKIE[$key] = $value; - // Используем setcookie с полным набором параметров для безопасности + // We use setcookie with a full set of parameters for security setcookie($key, $value, [ 'expires' => $expire, 'path' => $path, diff --git a/src/Interfaces/FactoryInterface.php b/src/Interfaces/FactoryInterface.php index 4af6ccb..9b9daab 100644 --- a/src/Interfaces/FactoryInterface.php +++ b/src/Interfaces/FactoryInterface.php @@ -13,8 +13,5 @@ interface FactoryInterface { - /** - * @return object - */ public function create(): object; } diff --git a/src/Interfaces/RequestInterface.php b/src/Interfaces/RequestInterface.php index b95a936..a19a0aa 100644 --- a/src/Interfaces/RequestInterface.php +++ b/src/Interfaces/RequestInterface.php @@ -16,38 +16,11 @@ interface RequestInterface { - /** - * @return ContainerInterface - */ public function get(): ContainerInterface; - - /** - * @return ContainerInterface - */ public function post(): ContainerInterface; - - /** - * @return ContainerInterface - */ public function put(): ContainerInterface; - - /** - * @return ContainerInterface - */ public function patch(): ContainerInterface; - - /** - * @return ContainerInterface - */ public function delete(): ContainerInterface; - - /** - * @return ContainerInterface - */ public function server(): ContainerInterface; - - /** - * @return ContainerInterface - */ public function files(): ContainerInterface; } diff --git a/src/Interfaces/ResponseInterface.php b/src/Interfaces/ResponseInterface.php index 486c484..2092f15 100644 --- a/src/Interfaces/ResponseInterface.php +++ b/src/Interfaces/ResponseInterface.php @@ -13,9 +13,5 @@ interface ResponseInterface { - /** - * @param array $data - * @return void - */ public function json(array $data): void; } diff --git a/src/Interfaces/RudraInterface.php b/src/Interfaces/RudraInterface.php index 7d0a2d1..d2929df 100644 --- a/src/Interfaces/RudraInterface.php +++ b/src/Interfaces/RudraInterface.php @@ -13,14 +13,5 @@ interface RudraInterface { - /** - * Implements the Singleton pattern to ensure only one instance of the class is created. - * If the instance does not exist, it creates and stores it. Otherwise, it returns the existing instance. - * ------------------------- - * Реализует паттерн Singleton, чтобы гарантировать создание только одного экземпляра класса. - * Если экземпляр не существует, он создаётся и сохраняется. В противном случае возвращается существующий экземпляр. - * - * @return RudraInterface - */ public static function run(): RudraInterface; } diff --git a/src/Request.php b/src/Request.php index 5dec82f..baaf2a6 100644 --- a/src/Request.php +++ b/src/Request.php @@ -11,74 +11,51 @@ namespace Rudra\Container; -use Rudra\Container\{ - Container, - Traits\InstantiationsTrait, - Interfaces\RequestInterface, -}; +use Rudra\Container\Container; +use Rudra\Container\Traits\InstantiationsTrait; +use Rudra\Container\Interfaces\RequestInterface; use Psr\Container\ContainerInterface; class Request implements RequestInterface { use InstantiationsTrait; - /** - * @return ContainerInterface - */ #[\Override] public function get(): ContainerInterface { return $this->containerize("get", Container::class, $_GET); } - /** - * @return ContainerInterface - */ #[\Override] public function post(): ContainerInterface { return $this->containerize("post", Container::class, $_POST); } - /** - * @return ContainerInterface - */ #[\Override] public function put(): ContainerInterface { return $this->containerize("put", Container::class); } - /** - * @return ContainerInterface - */ #[\Override] public function patch(): ContainerInterface { return $this->containerize("patch", Container::class); } - /** - * @return ContainerInterface - */ #[\Override] public function delete(): ContainerInterface { return $this->containerize("delete", Container::class); } - /** - * @return ContainerInterface - */ #[\Override] public function server(): ContainerInterface { return $this->containerize("server", Container::class, $_SERVER); } - /** - * @return ContainerInterface - */ #[\Override] public function files(): ContainerInterface { diff --git a/src/Response.php b/src/Response.php index 2377b15..a7a33a9 100755 --- a/src/Response.php +++ b/src/Response.php @@ -15,10 +15,6 @@ class Response implements ResponseInterface { - /** - * @param array $data - * @return void - */ #[\Override] public function json(array $data, int $code = 200): void { @@ -30,10 +26,6 @@ public function json(array $data, int $code = 200): void print $this->getJson($data); } - /** - * @param array $data - * @return string - */ private function getJson(array $data): string { return json_encode($data, JSON_UNESCAPED_UNICODE); diff --git a/src/Rudra.php b/src/Rudra.php index e822611..5437497 100644 --- a/src/Rudra.php +++ b/src/Rudra.php @@ -19,9 +19,9 @@ use Psr\Container\ContainerInterface; /** - * @method waiting() Returns a container for temporary data / Возвращает контейнер для временных данных - * @method binding() Returns a container for bindings / Возвращает контейнер для связываний - * @method services() Returns a container for services / Возвращает контейнер для сервисов + * @method waiting() Returns a container for temporary data + * @method binding() Returns a container for bindings + * @method services() Returns a container for services */ class Rudra implements RudraInterface, ContainerInterface { @@ -51,22 +51,11 @@ public function __construct() /** * Handles dynamic method calls for the class. - * If the method exists in `allowedContainersMap`, it initializes a container + * If the method exists in `allowedContainersMap`, it initializes a container. * with the provided data and returns it. - * If the method exists in `allowedInstances`, it initializes and returns + * If the method exists in `allowedInstances`, it initializes and returns. * the corresponding instance. * If the method is not allowed (not found in either map), it throws a LogicException. - * ------------------------- - * Обрабатывает динамические вызовы методов для класса. - * Если метод существует в `allowedContainersMap`, инициализирует контейнер - * с предоставленными данными и возвращает его. - * Если метод существует в `allowedInstances`, инициализирует и возвращает - * соответствующий экземпляр. - * Если метод не разрешён (не найден ни в одной из карт), выбрасывается исключение LogicException. - * - * @param string $method - * @param array $parameters - * @return mixed */ public function __call(string $method, array $parameters = []): mixed { @@ -85,11 +74,6 @@ public function __call(string $method, array $parameters = []): mixed /** * Implements the Singleton pattern to ensure only one instance of the class is created. * If the instance does not exist, it creates and stores it. Otherwise, it returns the existing instance. - * ------------------------- - * Реализует паттерн Singleton, чтобы гарантировать создание только одного экземпляра класса. - * Если экземпляр не существует, он создаётся и сохраняется. В противном случае возвращается существующий экземпляр. - * - * @return RudraInterface */ #[\Override] public static function run(): RudraInterface @@ -106,14 +90,6 @@ public static function run(): RudraInterface * If the service exists in the container, it is returned directly. * If the service does not exist, it checks if the service can be resolved from the waiting storage or class name. * If the service cannot be resolved, it throws a NotFoundException. - * ------------------------- - * Извлекает сервис по его идентификатору из контейнера сервисов или хранилища ожидания. - * Если сервис существует в контейнере, он возвращается напрямую. - * Если сервис не существует, проверяется, может ли он быть разрешён из хранилища ожидания или имени класса. - * Если сервис не может быть разрешён, выбрасывается исключение NotFoundException. - * - * @param string $id - * @return mixed */ #[\Override] public function get(string $id): mixed @@ -147,14 +123,6 @@ public function get(string $id): mixed * If the key is not a string, it throws a LogicException. * If the object is an array, it processes the array using `handleArrayObject`. * Otherwise, it resolves and sets the object using `resolveSetValue` and `setObject`. - * ------------------------- - * Устанавливает значение или объект в контейнере, идентифицированный ключом. - * Если ключ не является строкой, выбрасывается исключение LogicException. - * Если объект является массивом, он обрабатывается с помощью `handleArrayObject`. - * В противном случае объект разрешается и устанавливается с помощью `resolveSetValue` и `setObject`. - * - * @param array $data - * @return void */ public function set(array $data): void { @@ -177,15 +145,6 @@ public function set(array $data): void * If the array contains more than one element and the first element is not an object, * it processes the array using dependency injection via the `iOc` method. * Otherwise, it resolves and sets the first element as the value for the given key. - * ------------------------- - * Обрабатывает массив объектов во время процесса установки. - * Если массив содержит более одного элемента, и первый элемент не является объектом, - * он обрабатывает массив с использованием внедрения зависимостей через метод `iOc`. - * В противном случае разрешает и устанавливает первый элемент как значение для указанного ключа. - * - * @param string $key - * @param array $object - * @return void */ private function handleArrayObject(string $key, array $object): void { @@ -206,15 +165,6 @@ private function handleArrayObject(string $key, array $object): void * If the value is a string matching the factory naming convention (ends with "Factory") and the class exists, * it instantiates the class and calls its `create()` method. * Otherwise, it returns the value as-is. - * ------------------------- - * Разрешает значение, которое должно быть установлено в контейнере, на основе его типа. - * Если значение является замыканием (Closure), оно выполняется, и возвращается результат. - * Если значение — строка, соответствующая соглашению об именовании фабрик (оканчивается на "Factory"), - * и класс существует, создаётся его экземпляр и вызывается метод `create()`. - * В противном случае значение возвращается без изменений. - * - * @param mixed $value - * @return mixed */ private function resolveSetValue(mixed $value): mixed { @@ -232,12 +182,6 @@ private function resolveSetValue(mixed $value): mixed /** * Checks if the given value represents a valid implementation of the FactoryInterface. * The value is considered valid if it is a string, the class exists, and it is a subclass of FactoryInterface. - * ------------------------- - * Проверяет, представляет ли данное значение допустимую реализацию интерфейса FactoryInterface. - * Значение считается допустимым, если оно является строкой, класс существует и является подклассом FactoryInterface. - * - * @param mixed $value - * @return boolean */ private function isFactoryImplementation(mixed $value): bool { @@ -260,14 +204,6 @@ public function has(string $id): bool * Sets an object or class in the service container. * If the provided value is an object, it is directly stored in the service container. * If the provided value is a string (class name), it resolves and sets the object using the `iOc` method. - * ------------------------- - * Устанавливает объект или класс в контейнере сервисов. - * Если предоставленное значение является объектом, он сохраняется напрямую в контейнере сервисов. - * Если предоставленное значение является строкой (имя класса), разрешается и устанавливается объект с использованием метода `iOc`. - * - * @param string $key - * @param string|object $object - * @return void */ private function setObject(string $key, string|object $object): void { @@ -284,17 +220,6 @@ private function setObject(string $key, string|object $object): void * If the constructor has parameters, it resolves them using `getParamsIoC` and creates the instance with the resolved arguments. * If the constructor has no parameters, it creates the instance directly. * The created instance is then stored in the service container with the specified key. - * ------------------------- - * Разрешает и устанавливает объект в контейнере сервисов с использованием внедрения зависимостей. - * Использует рефлексию для анализа конструктора указанного класса. - * Если конструктор имеет параметры, они разрешаются с помощью `getParamsIoC`, и экземпляр создаётся с использованием разрешённых аргументов. - * Если конструктор не имеет параметров, экземпляр создаётся напрямую. - * Созданный экземпляр затем сохраняется в контейнере сервисов с указанным ключом. - * - * @param string $key - * @param string $object - * @param array|null $params - * @return void */ private function iOc(string $key, string $object, ?array $params = null): void { @@ -315,14 +240,6 @@ private function iOc(string $key, string $object, ?array $params = null): void * Creates and returns a new instance of the specified class. * If the class has a constructor with parameters, it resolves and injects them using the provided parameters. * If the class does not exist, it throws a LogicException. - * ------------------------- - * Создаёт и возвращает новый экземпляр указанного класса. - * Если у класса есть конструктор с параметрами, разрешает их и внедряет, используя предоставленные параметры. - * Если класс не существует, выбрасывается исключение LogicException. - * - * @param string $object - * @param array|null $params - * @return object */ public function new(string $object, ?array $params = null): object { @@ -345,15 +262,6 @@ public function new(string $object, ?array $params = null): object * Automatically resolves and invokes a method on the given object using dependency injection. * It uses reflection to analyze the method's parameters and resolves them using `getParamsIoC`. * If the method has no parameters, it is invoked directly. Otherwise, the resolved arguments are passed during invocation. - * ------------------------- - * Автоматически разрешает и вызывает метод у указанного объекта с использованием внедрения зависимостей. - * Использует рефлексию для анализа параметров метода и разрешает их с помощью `getParamsIoC`. - * Если метод не имеет параметров, он вызывается напрямую. В противном случае разрешённые аргументы передаются при вызове. - * - * @param object|string $object - * @param string $method - * @param array|null $params - * @return mixed */ public function autowire(object|string$object, string $method, ?array $params = null): mixed { @@ -371,15 +279,6 @@ public function autowire(object|string$object, string $method, ?array $params = /** * Resolves and retrieves parameters for dependency injection based on the constructor's reflection. * It processes each parameter of the constructor, resolving dependencies using bindings, class names, or default values. - * If a parameter cannot be resolved, it uses the provided `$params` array. - * ------------------------- - * Разрешает и извлекает параметры для внедрения зависимостей на основе рефлексии конструктора. - * Обрабатывает каждый параметр конструктора, разрешая зависимости с использованием привязок, имён классов или значений по умолчанию. - * Если параметр не может быть разрешён, используется предоставленный массив `$params`. - * - * @param \ReflectionMethod $constructor - * @param array|null $params - * @return array */ public function getParamsIoC(\ReflectionMethod $constructor, ?array $params): array { @@ -420,16 +319,6 @@ public function getParamsIoC(\ReflectionMethod $constructor, ?array $params): ar * If the dependency exists in the waiting storage, it retrieves and resolves the service recursively. * If the dependency is a string representing an existing class, it resolves the class using `resolveClass`. * Otherwise, it creates and returns a new instance of the class. - * ------------------------- - * Разрешает зависимость на основе предоставленного имени класса или объекта. - * Если зависимость является замыканием (Closure), оно выполняется, и возвращается результат. - * Если зависимость является объектом, разрешает объект с помощью `resolveObject`. - * Если зависимость существует в хранилище ожидания, извлекает и разрешает сервис рекурсивно. - * Если зависимость является строкой, представляющей существующий класс, разрешает класс с помощью `resolveClass`. - * В противном случае создаётся и возвращается новый экземпляр класса. - * - * @param $className - * @return object */ private function resolveDependency($className): object { @@ -457,17 +346,9 @@ private function resolveDependency($className): object * Resolves a class by creating an instance of it. * If the class implements or is a subclass of `FactoryInterface`, it creates an instance and calls the `create` method. * Otherwise, it simply creates and returns a new instance of the class. - * ------------------------- - * Разрешает класс, создавая его экземпляр. - * Если класс реализует или является подклассом `FactoryInterface`, создаётся экземпляр, и вызывается метод `create`. - * В противном случае просто создаётся и возвращается новый экземпляр класса. - * - * @param string $className - * @return object */ private function resolveClass(string $className): object { - // Включить поддержку интерфейсов: третий аргумент = true if (is_subclass_of($className, FactoryInterface::class, true)) { return (new $className())->create(); } @@ -479,13 +360,6 @@ private function resolveClass(string $className): object * Resolves an object by checking if it implements the FactoryInterface. * If the object implements FactoryInterface, it calls the `create` method and returns the result. * Otherwise, it returns the object as-is. - * ------------------------- - * Разрешает объект, проверяя, реализует ли он интерфейс FactoryInterface. - * Если объект реализует FactoryInterface, вызывается метод `create`, и возвращается результат. - * В противном случае объект возвращается без изменений. - * - * @param object $object - * @return object */ private function resolveObject(object $object): object { diff --git a/src/Session.php b/src/Session.php index 93fcd3b..f2a4e22 100755 --- a/src/Session.php +++ b/src/Session.php @@ -15,10 +15,6 @@ class Session { - /** - * @param string $id - * @return mixed - */ public function get(string $id): mixed { return array_key_exists($id, $_SESSION) @@ -26,52 +22,31 @@ public function get(string $id): mixed : throw new NotFoundException("Запись в сессии не найдена для идентификатора: \"$id\""); } - /** - * @param array $data - * @return void - */ public function set(string $key, mixed $value): void { $_SESSION[$key] = $value; } - /** - * @param string $id - * @return boolean - */ public function has(string $id): bool { return array_key_exists($id, $_SESSION); } - /** - * @param string $key - * @return void - */ public function remove(string $key): void { unset($_SESSION[$key]); } - /** - * @return void - */ public function start(): void { session_start(); } - /** - * @return void - */ public function stop(): void { session_destroy(); } - /** - * @return void - */ public function clear(): void { $_SESSION = []; diff --git a/src/Traits/FacadeTrait.php b/src/Traits/FacadeTrait.php index 89f48ed..d8bbe9d 100644 --- a/src/Traits/FacadeTrait.php +++ b/src/Traits/FacadeTrait.php @@ -16,21 +16,11 @@ trait FacadeTrait { /** - * Handles static method calls for the Facade class. - * It dynamically resolves the underlying class name by removing "Facade" from the class name. - * If the resolved class does not exist, it attempts to clean up the class name by removing spaces. - * If the resolved class is not already registered in the container, it registers it. - * Finally, it delegates the static method call to the resolved class instance. - * ------------------------- - * Обрабатывает статические вызовы методов для класса Facade. - * Динамически разрешает имя базового класса, удаляя "Facade" из имени класса. - * Если разрешённый класс не существует, пытается очистить имя класса, удаляя пробелы. - * Если разрешённый класс ещё не зарегистрирован в контейнере, он регистрируется. - * В конце делегирует статический вызов метода экземпляру разрешённого класса. - * - * @param string $method - * @param array $parameters - * @return mixed + * Handles static method calls for the Facade class + * It dynamically resolves the underlying class name by removing "Facade" from the class name + * If the resolved class does not exist, it attempts to clean up the class name by removing spaces + * If the resolved class is not already registered in the container, it registers it + * Finally, it delegates the static method call to the resolved class instance */ public static function __callStatic(string $method, array $parameters = []): mixed { diff --git a/src/Traits/InstantiationsTrait.php b/src/Traits/InstantiationsTrait.php index 741ede4..9786c51 100755 --- a/src/Traits/InstantiationsTrait.php +++ b/src/Traits/InstantiationsTrait.php @@ -11,7 +11,6 @@ namespace Rudra\Container\Traits; -use ReflectionException; use Psr\Container\ContainerInterface; trait InstantiationsTrait @@ -19,20 +18,10 @@ trait InstantiationsTrait private array $containers = []; /** - * Creates and stores a container instance if it does not already exist. + * Creates and stores a container instance if it does not already exist * If the container for the given name does not exist in the `containers` array, - * it creates a new instance of the specified class with the provided data and stores it. - * Otherwise, it returns the existing container instance. - * ------------------------- - * Создаёт и сохраняет экземпляр контейнера, если он ещё не существует. - * Если контейнер с указанным именем отсутствует в массиве `containers`, - * создаётся новый экземпляр указанного класса с предоставленными данными и сохраняется. - * В противном случае возвращается существующий экземпляр контейнера. - * - * @param string $name - * @param string $instance - * @param array $data - * @return ContainerInterface + * it creates a new instance of the specified class with the provided data and stores it + * Otherwise, it returns the existing container instance */ private function containerize(string $name, string $instance, array $data = []): ContainerInterface { @@ -40,18 +29,9 @@ private function containerize(string $name, string $instance, array $data = []): } /** - * Initializes and retrieves an instance of a class or service. - * If the instance is not already registered in the container, it registers it with the provided data. - * The method uses the class name as the default instance if no specific instance is provided. - * ------------------------- - * Инициализирует и извлекает экземпляр класса или сервиса. - * Если экземпляр ещё не зарегистрирован в контейнере, он регистрируется с предоставленными данными. - * Метод использует имя класса в качестве экземпляра по умолчанию, если конкретный экземпляр не указан. - * - * @param string $name - * @param string|null $instance - * @param array $data - * @return mixed + * Initializes and retrieves an instance of a class or service + * If the instance is not already registered in the container, it registers it with the provided data + * The method uses the class name as the default instance if no specific instance is provided */ private function init(string $name, ?string $instance = null, array $data = []): mixed { diff --git a/src/Traits/SetRudraContainersTrait.php b/src/Traits/SetRudraContainersTrait.php index 0e1e9fe..1ab4a7a 100644 --- a/src/Traits/SetRudraContainersTrait.php +++ b/src/Traits/SetRudraContainersTrait.php @@ -16,14 +16,8 @@ trait SetRudraContainersTrait { - /** - * @param RudraInterface $rudra - */ public function __construct(private RudraInterface $rudra) {} - /** - * @return RudraInterface - */ public function rudra(): RudraInterface { if (!isset($this->rudra)) {