Version 3.0
New technologies
This commit is contained in:
27
api/common/Concept/Database.php
Normal file
27
api/common/Concept/Database.php
Normal file
@ -0,0 +1,27 @@
|
||||
<?php
|
||||
namespace Common\Concept;
|
||||
|
||||
interface Database
|
||||
{
|
||||
public function setHost(string $host, ?int $port = null): Database;
|
||||
public function getHost(): string;
|
||||
public function getPort(): int;
|
||||
public function setName(string $database_name): Database;
|
||||
public function getName(): string;
|
||||
public function setUser(string $username, string $password): Database;
|
||||
public function getUser(): string;
|
||||
public function getPassword(): string;
|
||||
public function getDsn(): string;
|
||||
public function needsUser(): bool;
|
||||
public function connect(): Database;
|
||||
public function getConnection(): \PDO;
|
||||
public function beginTransaction(): void;
|
||||
public function commit(): void;
|
||||
public function rollBack(): void;
|
||||
public function query(string $query): array;
|
||||
public function prepare(string $query): Database;
|
||||
public function execute(array $data): array;
|
||||
public function insert(array $values): void;
|
||||
public function update(array $data): void;
|
||||
public function delete(array $data): void;
|
||||
}
|
@ -1,11 +0,0 @@
|
||||
<?php
|
||||
namespace Contabilidad\Common\Concept;
|
||||
|
||||
use Contabilidad\Common\Alias\DocumentHandler as HandlerInterface;
|
||||
|
||||
abstract class DocumentHandler implements HandlerInterface {
|
||||
protected string $folder;
|
||||
public function __construct(string $source_folder) {
|
||||
$this->folder = $source_folder;
|
||||
}
|
||||
}
|
10
api/common/Concept/Factory/Model.php
Normal file
10
api/common/Concept/Factory/Model.php
Normal file
@ -0,0 +1,10 @@
|
||||
<?php
|
||||
namespace Common\Concept\Factory;
|
||||
|
||||
use Common\Concept\Model as ModelInterface;
|
||||
use Common\Concept\Repository;
|
||||
|
||||
interface Model
|
||||
{
|
||||
public function find(ModelInterface $model_name): Repository;
|
||||
}
|
16
api/common/Concept/File.php
Normal file
16
api/common/Concept/File.php
Normal file
@ -0,0 +1,16 @@
|
||||
<?php
|
||||
namespace Common\Concept;
|
||||
|
||||
interface File
|
||||
{
|
||||
public function setFilename(string $filename): File;
|
||||
public function getFilename(): string;
|
||||
|
||||
public function isDir(): bool;
|
||||
public function isReadable(): bool;
|
||||
public function isWriteable(): bool;
|
||||
|
||||
public function read(?int $length = null): string;
|
||||
public function write(string $data, ?int $length = null);
|
||||
public function append(string $data, ?int $length = null);
|
||||
}
|
17
api/common/Concept/Filesystem.php
Normal file
17
api/common/Concept/Filesystem.php
Normal file
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
namespace Common\Concept;
|
||||
|
||||
interface Filesystem
|
||||
{
|
||||
public function setBasePath(string $path): Filesystem;
|
||||
public function getBasePath(): string;
|
||||
|
||||
public function buildPath(string $relative_path): string;
|
||||
|
||||
public function has(string $relative_path): bool;
|
||||
|
||||
public function mkdir(string $relative_path): void;
|
||||
public function create(string $relative_path): void;
|
||||
public function get(string $relative_path): File;
|
||||
public function delete(string $relative_path): void;
|
||||
}
|
6
api/common/Concept/Model.php
Normal file
6
api/common/Concept/Model.php
Normal file
@ -0,0 +1,6 @@
|
||||
<?php
|
||||
namespace Common\Concept;
|
||||
|
||||
interface Model
|
||||
{
|
||||
}
|
11
api/common/Concept/Repository.php
Normal file
11
api/common/Concept/Repository.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
namespace Common\Concept;
|
||||
|
||||
interface Repository
|
||||
{
|
||||
public function fetchAll(): array;
|
||||
public function fetchByKey($key): Model;
|
||||
public function load(array $data_row): Model;
|
||||
public function save(Model $model): void;
|
||||
public function delete(Model $model): void;
|
||||
}
|
Reference in New Issue
Block a user