Extract Stringy to fix deprecations

This commit is contained in:
Timothy Warren 2023-03-16 13:03:48 -04:00
parent fffd75122f
commit 581fad9ccc
8 changed files with 2173 additions and 8 deletions

View File

@ -0,0 +1,22 @@
<?php declare(strict_types=1);
/**
* Hummingbird Anime List Client
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\Ion\Attribute;
use Attribute;
#[Attribute(Attribute::TARGET_CLASS)]
class Controller {
public function __construct(public string $prefix = '') {}
}

View File

@ -0,0 +1,20 @@
<?php declare(strict_types=1);
/**
* Hummingbird Anime List Client
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\Ion\Attribute;
use Attribute;
#[Attribute(Attribute::TARGET_CLASS)]
class DefaultController {}

View File

@ -0,0 +1,32 @@
<?php declare(strict_types=1);
/**
* Hummingbird Anime List Client
*
* An API client for Kitsu to manage anime and manga watch lists
*
* PHP version 8
*
* @copyright 2015 - 2022 Timothy J. Warren <tim@timshome.page>
* @license http://www.opensource.org/licenses/mit-license.html MIT License
* @version 5.2
* @link https://git.timshome.page/timw4mail/HummingBirdAnimeClient
*/
namespace Aviat\Ion\Attribute;
use Attribute;
#[Attribute(Attribute::TARGET_FUNCTION | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
class Route {
public const GET = 'get';
public const POST = 'post';
public function __construct(
public string $name,
public string $path,
public string $verb = self::GET,
)
{
}
}

View File

@ -37,7 +37,8 @@ class Container implements ContainerInterface
* *
* @param (callable)[] $container (optional) * @param (callable)[] $container (optional)
*/ */
public function __construct(/** public function __construct(
/**
* Array of container Generator functions * Array of container Generator functions
*/ */
protected array $container = [] protected array $container = []

View File

@ -19,7 +19,7 @@ namespace Aviat\Ion;
*/ */
class Event class Event
{ {
private static array $eventMap = []; protected static array $eventMap = [];
/** /**
* Subscribe to an event * Subscribe to an event

View File

@ -15,12 +15,11 @@
namespace Aviat\Ion\Type; namespace Aviat\Ion\Type;
use InvalidArgumentException; use InvalidArgumentException;
use Stringy\Stringy;
/** /**
* Wrapper around Stringy * Slightly extended Stringy library
*/ */
class StringType extends Stringy final class StringType extends Stringy
{ {
/** /**
* Alias for `create` static constructor * Alias for `create` static constructor

2083
src/Ion/Type/Stringy.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -81,6 +81,14 @@ class HttpView implements HttpViewInterface, Stringable
return $this->getOutput(); return $this->getOutput();
} }
/**
* Alternate static constructor
*/
public static function new(): static
{
return new static();
}
/** /**
* Add an http header * Add an http header
* *