https://github.com/bluzphp/container
Container Package
https://github.com/bluzphp/container
bluz-package php php-library
Last synced: 5 months ago
JSON representation
Container Package
- Host: GitHub
- URL: https://github.com/bluzphp/container
- Owner: bluzphp
- License: mit
- Created: 2022-07-17T10:40:23.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-09-10T11:39:42.000Z (over 1 year ago)
- Last Synced: 2025-05-23T21:07:19.258Z (9 months ago)
- Topics: bluz-package, php, php-library
- Language: PHP
- Homepage:
- Size: 26.4 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Container Component
## Achievements
[](https://php.net/)
[](https://packagist.org/packages/bluzphp/container)
[](https://scrutinizer-ci.com/g/bluzphp/container/build-status/master)
[](https://scrutinizer-ci.com/g/bluzphp/container/)
[](https://packagist.org/packages/bluzphp/container)
[](https://packagist.org/packages/bluzphp/container)
## Usage
Example of the Registry class:
```
namespace Bluz\Registry;
use Bluz\Container;
class Registry {
use Container\Container;
use Container\JsonSerialize;
use Container\RegularAccess;
}
```
### Methods
Public methods of the `Container\Container`:
* `setFromArray(array $data)`
* `toArray()`
* `resetArray()`
*
Protected methods of the `Container\Container`:
* `doSetContainer(string $key, mixed $value)` - set the `value` by the `key`
* `doGetContainer(string $key)` – if the container has the `key`, then it returns the `value`, otherwise `null`
* `doContainsContainer(string $key)` - check the container for the `key`
* `doDeleteContainer(string $key)` - remove the `value` by the `key`
Methods of the `Container\ArrayAccess` (implementation of the interface `ArrayAccess`):
* `offsetSet($offset, $value)`
* `offsetExists($offset)`
* `offsetUnset($offset)`
* `offsetGet($offset)`
Methods of the `Container\MagicAccess`:
* `__set($key, $value)`
* `__get($key)`
* `__isset($key)`
* `__unset($key)`
Methods of the `Container\RegularAccess`:
* `set($key, $value)`
* `get($key)`
* `has($key)`
* `remove($key)`
Methods of the `Container\JsonSerialize`
* `jsonSerialize()` - implementation of the interface `JsonSerializable`