Skip to content

Commit

Permalink
framework 1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
Sergey Surkov committed Aug 25, 2021
1 parent 6224af3 commit 5d2cf48
Show file tree
Hide file tree
Showing 41 changed files with 106 additions and 106 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"dissonance web"
],
"require": {
"php": ">=8.0",
"php": ">=7.2",
"psr/http-server-handler": "1.0.*",
"psr/http-server-middleware": "1.0.1",
"psr/http-factory": "1.0.1",
Expand Down
12 changes: 6 additions & 6 deletions src/Apps/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function getAppTitle(): string
return $this['config']->getAppName();
}

public function getRoutingProvider(): ?string
public function getRoutingProvider(): string
{
return $this['config']->getRoutingProvider();
}
Expand All @@ -64,7 +64,7 @@ public function hasParentApp(): bool
return $this['config']->hasParentApp();
}

public function getParentAppId(): ?string
public function getParentAppId(): string
{
return $this['config']->getParentAppId();
}
Expand Down Expand Up @@ -117,7 +117,7 @@ protected function registerProviders()
* @param string|null $path
* @return string|null
*/
public function getBasePath(string $path = null): ?string
public function getBasePath(string $path = null)
{
$base = $this('config::base_path');
return $base ? ($path ? $base . \_DS\DS . ltrim($path) : $base) : null;
Expand All @@ -127,7 +127,7 @@ public function getBasePath(string $path = null): ?string
* @return string|null
* @deprecated
*/
public function getAssetsPath(): ?string
public function getAssetsPath()
{
return $this->getBasePath('assets');
}
Expand All @@ -136,15 +136,15 @@ public function getAssetsPath(): ?string
* @return string|null
* @deprecated
*/
public function getResourcesPath(): ?string
public function getResourcesPath()
{
return $this->getBasePath('resources');
}

/**
* @return ApplicationInterface|null
*/
protected function getParentApp(): ?ApplicationInterface
protected function getParentApp()
{
return $this->hasParentApp() ? $this[AppsRepositoryInterface::class]->get($this->getParentAppId()) : null;
}
Expand Down
6 changes: 3 additions & 3 deletions src/Apps/ApplicationInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,19 @@
interface ApplicationInterface extends AppConfigInterface, DIContainerInterface, ServiceContainerInterface
{

public function getBasePath(string $path = null): ?string;
public function getBasePath(string $path = null);

/**
* @return string|null
* @deprecated
*/
public function getAssetsPath(): ?string;
public function getAssetsPath();

/**
* @return string|null
* @deprecated
*/
public function getResourcesPath(): ?string;
public function getResourcesPath();

/**
* @param array|\Closure[]|null $bootstraps
Expand Down
8 changes: 4 additions & 4 deletions src/Apps/AppsRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,21 @@ class AppsRepository implements AppsRepositoryInterface
/**
* @var ApplicationInterface[]
*/
protected array $apps = [];
protected $apps = [];
/**
* @var array
*/
protected array $apps_plugins = [];
protected $apps_plugins = [];

/**
* @var array
*/
protected array $apps_config = [];
protected $apps_config = [];

/**
* @var array
*/
protected array $disabled_apps = [];
protected $disabled_apps = [];

/**
* @param array $ids
Expand Down
12 changes: 6 additions & 6 deletions src/Container/BaseContainerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ trait BaseContainerTrait /*implements \Dissonance\Container\BaseContainerInterfa
* @return array|\ArrayAccess
* @todo: Can do protected, on the one hand it is convenient, but to give everyone in a row to manage is not correct!?
*/
abstract protected function &getContainerItems(): array|\ArrayAccess;
abstract protected function &getContainerItems();

/**
* @param string $key
Expand All @@ -28,7 +28,7 @@ abstract protected function &getContainerItems(): array|\ArrayAccess;
*
* @return mixed|null
*/
public function get(string|int $key)
public function get($key)
{
$items = &$this->getContainerItems();
return $this->hasBy($key,$items) ? $items[$key] :
Expand All @@ -43,7 +43,7 @@ public function get(string|int $key)
* @info
* @return bool
*/
public function has(string|int $key): bool
public function has($key): bool
{
$items = &$this->getContainerItems();
return $this->hasBy($key,$items);
Expand All @@ -55,7 +55,7 @@ public function has(string|int $key): bool
* @return bool
* @info
*/
private function hasBy(string|int $key, \ArrayAccess|array &$items): bool
private function hasBy($key, &$items): bool
{
return isset($items[$key]) // isset в 4 раза быстрее array_key_exists
|| (is_array($items) && array_key_exists($key, $items))
Expand All @@ -66,7 +66,7 @@ private function hasBy(string|int $key, \ArrayAccess|array &$items): bool
* @param int|string $key
* @param $value
*/
public function set(string|int $key, $value): void
public function set($key, $value): void
{
$items = &$this->getContainerItems();
$items[$key] = $value;
Expand All @@ -77,7 +77,7 @@ public function set(string|int $key, $value): void
* @param int|string $key
* @return mixed
*/
public function delete(string|int $key): bool
public function delete($key): bool
{
$items = &$this->getContainerItems();
unset($items[$key]);
Expand Down
2 changes: 1 addition & 1 deletion src/Container/CachedContainerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ interface CachedContainerInterface extends DIContainerInterface, \Serializable
* @param string $abstract - ключ сервиса для кеширования, использовать интерфейс с которым был добавлен сервис
*
*/
public function cached(string $abstract, Closure|string $concrete = null, string $alias = null);
public function cached(string $abstract, $concrete = null, string $alias = null);

public function addToCache(string $abstract);
}
8 changes: 4 additions & 4 deletions src/Container/CachedContainerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ trait CachedContainerTrait /*implements CachedContainerInterface*/
/**
* @var null|CacheInterface
*/
protected ?CacheInterface $container_cache = null;
protected $container_cache = null;

protected string $container_key = '';
protected $container_key = '';
/**
* Массив ключей разрешенных сервисов для кеширования
* @var array|string[]
*/
protected array $allow_cached = [];
protected $allow_cached = [];

/**
* set cache storage
Expand All @@ -47,7 +47,7 @@ public function addToCache(string $abstract)
* @param string $abstract - ключ сервиса для кеширования
*
*/
public function cached(string $abstract, Closure|string $concrete = null, string $alias = null)
public function cached(string $abstract, $concrete = null, string $alias = null)
{

/**
Expand Down
16 changes: 8 additions & 8 deletions src/Container/ContainerTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public function isAlias(string $name)
* @param bool $shared
* @return void
*/
public function bind(string $abstract, Closure|string $concrete = null, bool $shared = false): void
public function bind(string $abstract, $concrete = null, bool $shared = false): void
{
unset($this->instances[$abstract], $this->aliases[$abstract]);

Expand Down Expand Up @@ -277,7 +277,7 @@ public function getClosure(string $abstract, string $concrete)
* @param bool $shared
* @return $this
*/
public function bindIf(string $abstract, Closure|string $concrete = null, bool $shared = false)
public function bindIf(string $abstract, $concrete = null, bool $shared = false)
{
if (!$this->bound($abstract)) {
$this->bind($abstract, $concrete, $shared);
Expand All @@ -294,7 +294,7 @@ public function bindIf(string $abstract, Closure|string $concrete = null, bool $
* @param string|null $alias
* @return static
*/
public function singleton(string $abstract, Closure|string $concrete = null, string $alias = null)
public function singleton(string $abstract, $concrete = null, string $alias = null)
{
$this->bind($abstract, $concrete, true);
if (is_string($alias)) {
Expand Down Expand Up @@ -459,7 +459,7 @@ public function wrap(\Closure $callback, array $parameters = [], $defaultMethod
* @param string|null $defaultMethod
* @return mixed
*/
public function call(callable|string $callback, array $parameters = [], string $defaultMethod = null)
public function call($callback, array $parameters = [], string $defaultMethod = null)
{
return BoundMethod::call($this, $callback, $parameters, $defaultMethod);
}
Expand Down Expand Up @@ -625,7 +625,7 @@ protected function getContextualConcrete(string $for_building, string $need)
* @param string $abstract
* @return bool
*/
protected function isBuildable(string|\Closure $concrete, string $abstract)
protected function isBuildable($concrete, string $abstract)
{
return $concrete === $abstract || $concrete instanceof \Closure;
}
Expand All @@ -638,7 +638,7 @@ protected function isBuildable(string|\Closure $concrete, string $abstract)
*
* @throws BindingResolutionException|ContainerException
*/
public function build(string|Closure $concrete)
public function build($concrete)
{
// If the concrete type is actually a Closure, we will just execute it and
// hand back the results of the functions, which allows functions to be
Expand Down Expand Up @@ -831,7 +831,7 @@ protected function resolveClass(\ReflectionParameter $parameter)
* @param callable|null $callback closure or Invokable object
* @return void
*/
public function resolving(string|\Closure $abstract, callable $callback = null)
public function resolving($abstract, callable $callback = null)
{
if (is_string($abstract)) {
$abstract = $this->getAlias($abstract);
Expand All @@ -851,7 +851,7 @@ public function resolving(string|\Closure $abstract, callable $callback = null)
* @param callable|null $callback closure or Invokable object
* @return void
*/
public function afterResolving(\Closure|string $abstract, callable $callback = null)
public function afterResolving($abstract, callable $callback = null)
{
if (is_string($abstract)) {
$abstract = $this->getAlias($abstract);
Expand Down
2 changes: 1 addition & 1 deletion src/Container/ContextualBindingBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class ContextualBindingBuilder
* @param string|array $concrete
* @return void
*/
public function __construct(DIContainerInterface $container, string|array $concrete)
public function __construct(DIContainerInterface $container, $concrete)
{
$this->concrete = $concrete;
$this->container = $container;
Expand Down
2 changes: 1 addition & 1 deletion src/Container/ContextualBindingsInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface ContextualBindingsInterface
*
* @return ContextualBindingBuilder
*/
public function when(string|array $concrete): ContextualBindingBuilder;
public function when($concrete): ContextualBindingBuilder;


/**
Expand Down
4 changes: 2 additions & 2 deletions src/Container/ContextualBindingsTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ trait ContextualBindingsTrait /*implements ContextualBindingsInterface*/
*
* @var string[][]
*/
public array $contextual = [];
public $contextual = [];

/**
* Define a contextual binding.
*
* @param array|string $concrete
* @return ContextualBindingBuilder
*/
public function when(string|array $concrete): ContextualBindingBuilder
public function when($concrete): ContextualBindingBuilder
{
/**
* @var DIContainerInterface $this
Expand Down
14 changes: 7 additions & 7 deletions src/Container/DIContainerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function alias(string $abstract, string $alias);
* @param bool $shared
* @return void
*/
public function bind(string $abstract, Closure|string $concrete = null, bool $shared = false): void;
public function bind(string $abstract, $concrete = null, bool $shared = false): void;

/**
* Bind a new callback to an abstract's rebind event.
Expand All @@ -59,7 +59,7 @@ public function rebinding(string $abstract, Closure $callback);
* @param bool $shared
* @return void
*/
public function bindIf(string $abstract, Closure|string $concrete = null, bool $shared = false);
public function bindIf(string $abstract, $concrete = null, bool $shared = false);

/**
* Register a shared binding in the container.
Expand All @@ -69,7 +69,7 @@ public function bindIf(string $abstract, Closure|string $concrete = null, bool $
* @param string|null $alias
* @return static
*/
public function singleton(string $abstract, Closure|string $concrete = null, string $alias = null);
public function singleton(string $abstract, $concrete = null, string $alias = null);

/**
* "Extend" an abstract type in the container.
Expand Down Expand Up @@ -109,7 +109,7 @@ public function resolve(string $abstract, array $parameters = [], bool $raiseEve
* @return mixed
* @example function(DependencyInjectionInterface $container, array $params = []){.... return $object;}
*/
public function build(string|Closure $concrete);
public function build($concrete);


/**
Expand All @@ -135,7 +135,7 @@ public function clear():void;
* @param string|null $defaultMethod
* @return mixed
*/
public function call(callable|string $callback, array $parameters = [], string $defaultMethod = null);
public function call($callback, array $parameters = [], string $defaultMethod = null);

/**
* Determine if the given abstract type has been resolved.
Expand All @@ -152,7 +152,7 @@ public function resolved(string $abstract);
* @param callable|null $callback
* @return void
*/
public function resolving(string|Closure $abstract, callable $callback = null);
public function resolving($abstract, callable $callback = null);

/**
* Register a new after resolving callback.
Expand All @@ -161,7 +161,7 @@ public function resolving(string|Closure $abstract, callable $callback = null);
* @param callable|null $callback
* @return void
*/
public function afterResolving(string|Closure $abstract, callable $callback = null);
public function afterResolving($abstract, callable $callback = null);

/**
* Determine if a given string is an alias.
Expand Down
2 changes: 1 addition & 1 deletion src/Container/DeepGetterTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
trait DeepGetterTrait /* implements ContainerInterface*/
{

private string $deep_delimiter = '::';
private $deep_delimiter = '::';

/**
* @param string $key - Возможно использование доступа внутри объекта через точку ,
Expand Down
Loading

0 comments on commit 5d2cf48

Please sign in to comment.