Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
],
"require": {
"php": "^8.0",
"dragon-code/contracts": "^2.21",
"dragon-code/support": "^6.11.3",
"illuminate/contracts": "^10.0||^11.0",
"illuminate/support": ">=6.0 <12.0"
},
"require-dev": {
Expand Down
5 changes: 1 addition & 4 deletions src/Concerns/Arrayable.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
use BackedEnum;
use Carbon\Carbon;
use Closure;
use DragonCode\Contracts\Support\Arrayable as DragonCodeArrayable;
use DragonCode\Support\Facades\Helpers\Arr;
use DragonCode\Support\Facades\Instances\Instance;
use DragonCode\Support\Facades\Instances\Reflection;
Expand Down Expand Up @@ -97,12 +96,10 @@ protected function isArrayable($value): bool

if (
Instance::of($value, [
DragonCodeArrayable::class,
IlluminateArrayable::class,
ArrayableHelper::class,
IlluminateArrayable::class,
ArrayObject::class,
ArrayAccess::class,
DragonCodeArrayable::class,
])
) {
return true;
Expand Down
6 changes: 0 additions & 6 deletions src/Concerns/Has.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Carbon\Carbon;
use Closure;
use DateTimeInterface;
use DragonCode\Contracts\Cache\Ttl;
use DragonCode\Support\Facades\Instances\Instance;
use DragonCode\Support\Facades\Types\Is;

Expand All @@ -27,9 +26,4 @@ protected function hasObject($value): bool
{
return Is::object($value);
}

protected function hasContract($value): bool
{
return Instance::of($value, Ttl::class);
}
}
6 changes: 3 additions & 3 deletions src/Facades/Support/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@

use ArrayObject;
use DragonCode\Cache\Support\Key as Support;
use DragonCode\Contracts\DataTransferObject\DataTransferObject;
use DragonCode\Contracts\Support\Arrayable;
use DragonCode\SimpleDataTransferObject\DataTransferObject;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Facades\Facade;

/**
* @method static string get(string $separator, array|Arrayable|\Illuminate\Contracts\Support\Arrayable|ArrayObject|DataTransferObject $values, bool $hash = true)
* @method static string get(string $separator, array|Arrayable|ArrayObject|DataTransferObject $values, bool $hash = true)
*/
class Key extends Facade
{
Expand Down
6 changes: 3 additions & 3 deletions src/Facades/Support/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
namespace DragonCode\Cache\Facades\Support;

use DragonCode\Cache\Support\Tag as Support;
use DragonCode\Contracts\DataTransferObject\DataTransferObject;
use DragonCode\Contracts\Support\Arrayable;
use DragonCode\SimpleDataTransferObject\DataTransferObject;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Support\Facades\Facade;

/**
* @method static array get(array|Arrayable|\Illuminate\Contracts\Support\Arrayable|\ArrayObject|DataTransferObject $tags)
* @method static array get(array|Arrayable|\ArrayObject|DataTransferObject $tags)
*/
class Tag extends Facade
{
Expand Down
3 changes: 1 addition & 2 deletions src/Services/Storages/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
namespace DragonCode\Cache\Services\Storages;

use DragonCode\Cache\Concerns\Call;
use DragonCode\Contracts\Cache\Store as BaseStore;
use DragonCode\Support\Concerns\Makeable;

abstract class Store implements BaseStore
abstract class Store
{
use Call;
use Makeable;
Expand Down
9 changes: 2 additions & 7 deletions src/Support/CacheManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

use DragonCode\Cache\Services\Storages\Disabled;
use DragonCode\Cache\Services\Storages\MainStore;
use DragonCode\Cache\Services\Storages\Store;
use DragonCode\Cache\Services\Storages\TaggedStore;
use DragonCode\Contracts\Cache\Store;
use DragonCode\Support\Concerns\Makeable;
use Illuminate\Support\Facades\Cache;

/**
* @method static CacheManager make(bool $when = true)
*/
class CacheManager implements Store
class CacheManager extends Store
{
use Makeable;

Expand Down Expand Up @@ -61,11 +61,6 @@ public function has(string $key): bool
return $this->instance()->has($key);
}

public function doesntHave(string $key): bool
{
return ! $this->has($key);
}

public function flush(): void
{
$this->instance()->flush();
Expand Down
3 changes: 1 addition & 2 deletions src/Support/Key.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@

use ArrayObject;
use DragonCode\Cache\Concerns\Arrayable;
use DragonCode\Contracts\Support\Arrayable as DragonArrayable;
use Illuminate\Contracts\Support\Arrayable as IlluminateArrayable;

class Key
Expand All @@ -15,7 +14,7 @@ class Key

public function get(
string $separator,
array|ArrayObject|DragonArrayable|IlluminateArrayable $values,
array|ArrayObject|IlluminateArrayable $values,
bool $hash = true
): string {
$values = $this->toArray($values);
Expand Down
4 changes: 2 additions & 2 deletions src/Support/Tag.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@

use ArrayObject;
use DragonCode\Cache\Concerns\Arrayable;
use DragonCode\Contracts\DataTransferObject\DataTransferObject;
use DragonCode\SimpleDataTransferObject\DataTransferObject;
use DragonCode\Support\Facades\Helpers\Str;

class Tag
{
use Arrayable;

/**
* @param array|\DragonCode\Contracts\Support\Arrayable|\Illuminate\Contracts\Support\Arrayable|ArrayObject|DataTransferObject $tags
* @param array|\Illuminate\Contracts\Support\Arrayable|ArrayObject|DataTransferObject $tags
*/
public function get(mixed $tags): array
{
Expand Down
4 changes: 0 additions & 4 deletions src/Support/Ttl.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@ public function fromDateTime(DateTimeInterface $date_time): int

protected function get($value, int $multiplier = 1): int
{
if ($this->hasObject($value) && $this->hasContract($value)) {
$value = $value->cacheTtl();
}

if ($this->hasDateTime($value)) {
return $this->fromDateTime($value);
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Concerns/Dtoable.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Tests\Fixtures\Concerns;

use DragonCode\Contracts\DataTransferObject\DataTransferObject;
use DragonCode\SimpleDataTransferObject\DataTransferObject;
use Tests\Fixtures\Dto\DtoObject;

trait Dtoable
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Many/DragonCodeArrayable.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Tests\Fixtures\Many;

use DragonCode\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Arrayable;
use Tests\Fixtures\Simple\DragonCodeArrayable as Simple;

class DragonCodeArrayable implements Arrayable
Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Many/MixedArrayable.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Tests\Fixtures\Many;

use DragonCode\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Arrayable;
use Tests\Fixtures\Simple\DragonCodeArrayable as SimpleDragon;
use Tests\Fixtures\Simple\IlluminateArrayable as SimpleIlluminate;

Expand Down
2 changes: 1 addition & 1 deletion tests/Fixtures/Simple/DragonCodeArrayable.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

namespace Tests\Fixtures\Simple;

use DragonCode\Contracts\Support\Arrayable;
use Illuminate\Contracts\Support\Arrayable;

class DragonCodeArrayable implements Arrayable
{
Expand Down
12 changes: 4 additions & 8 deletions tests/Fixtures/Ttl/AsCarbon.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@
namespace Tests\Fixtures\Ttl;

use Carbon\Carbon;
use DragonCode\Contracts\Cache\Ttl;

class AsCarbon implements Ttl
class AsCarbon
{
protected $value;

public function __construct(string $value)
{
$this->value = $value;
}
public function __construct(
protected string $value
) {}

public function cacheTtl(): Carbon
{
Expand Down
3 changes: 1 addition & 2 deletions tests/Fixtures/Ttl/AsDateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

use DateTime;
use DateTimeInterface;
use DragonCode\Contracts\Cache\Ttl;

class AsDateTime implements Ttl
class AsDateTime
{
public function __construct(
protected string $value
Expand Down
13 changes: 4 additions & 9 deletions tests/Fixtures/Ttl/AsInteger.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@

namespace Tests\Fixtures\Ttl;

use DragonCode\Contracts\Cache\Ttl;

class AsInteger implements Ttl
class AsInteger
{
protected $value;

public function __construct(string $value)
{
$this->value = $value;
}
public function __construct(
protected string $value
) {}

public function cacheTtl(): int
{
Expand Down
13 changes: 4 additions & 9 deletions tests/Fixtures/Ttl/AsString.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,11 @@

namespace Tests\Fixtures\Ttl;

use DragonCode\Contracts\Cache\Ttl;

class AsString implements Ttl
class AsString
{
protected $value;

public function __construct(string $value)
{
$this->value = $value;
}
public function __construct(
protected string $value
) {}

public function cacheTtl(): string
{
Expand Down
Loading