This commit is contained in:
2021-08-17 16:23:49 +08:00
parent 1a89c6c8be
commit 7cbf6e3bdf
12 changed files with 631 additions and 598 deletions
-43
View File
@@ -1,43 +0,0 @@
<?php
namespace Annotation\Model;
use Attribute;
use Exception;
use Kiri\Kiri;
/**
* Class Get
* @package Annotation\Model
*/
#[Attribute(Attribute::TARGET_METHOD)] class Get extends \Annotation\Attribute
{
/**
* Get constructor.
* @param string $name
*/
public function __construct(public string $name)
{
}
/**
* @param mixed $class
* @param mixed|null $method
* @return bool
* @throws Exception
*/
public function execute(mixed $class, mixed $method = null): bool
{
$annotation = Kiri::getAnnotation();
$annotation->addGets($class, $this->name, $method);
return true;
}
}
-44
View File
@@ -1,44 +0,0 @@
<?php
namespace Annotation\Model;
use Annotation\Attribute;
use Database\ActiveRecord;
use Exception;
use JetBrains\PhpStorm\Pure;
use Kiri\Kiri;
/**
* Class Relation
* @package Annotation\Model
*/
#[\Attribute(\Attribute::TARGET_METHOD)] class Relation extends Attribute
{
/**
* Relation constructor.
* @param string $name
*/
public function __construct(public string $name)
{
}
/**
* @param mixed $class
* @param mixed|null $method
* @return bool
* @throws Exception
*/
public function execute(mixed $class, mixed $method = null): bool
{
$annotation = Kiri::getAnnotation();
$annotation->addRelate($class, $this->name, $method);
return true;
}
}
-39
View File
@@ -1,39 +0,0 @@
<?php
namespace Annotation\Model;
use Annotation\Attribute;
use Database\ActiveRecord;
use Exception;
use Kiri\Kiri;
#[\Attribute(\Attribute::TARGET_METHOD)] class Set extends Attribute
{
/**
* Set constructor.
* @param string $name
*/
public function __construct(public string $name)
{
}
/**
* @param mixed $class
* @param mixed|null $method
* @return bool
* @throws Exception
*/
public function execute(mixed $class, mixed $method = null): bool
{
$annotation = Kiri::getAnnotation();
$annotation->addSets($class, $this->name, $method);
return true;
}
}