Refactored \Tamer to \TamerLib

This commit is contained in:
Netkas 2023-02-05 17:27:32 -05:00
parent 1b8d2fb40a
commit 7eea383ce9
25 changed files with 81 additions and 81 deletions

View file

@ -1,6 +1,6 @@
<?php
namespace Tamer\Abstracts\ExitCodes;
namespace TamerLib\Abstracts\ExitCodes;
class WorkerExitCodes
{

View file

@ -1,6 +1,6 @@
<?php
namespace Tamer\Abstracts;
namespace TamerLib\Abstracts;
abstract class JobStatus
{

View file

@ -1,6 +1,6 @@
<?php
namespace Tamer\Abstracts;
namespace TamerLib\Abstracts;
abstract class Mode
{

View file

@ -1,6 +1,6 @@
<?php
namespace Tamer\Abstracts;
namespace TamerLib\Abstracts;
abstract class ProtocolType
{

View file

@ -1,6 +1,6 @@
<?php
namespace Tamer\Abstracts;
namespace TamerLib\Abstracts;
abstract class TaskPriority
{

View file

@ -1,14 +1,14 @@
<?php
namespace Tamer\Classes;
namespace TamerLib\Classes;
use Exception;
use InvalidArgumentException;
use OptsLib\Parse;
use Symfony\Component\Process\PhpExecutableFinder;
use Tamer\Abstracts\ProtocolType;
use Tamer\Interfaces\ClientProtocolInterface;
use Tamer\Interfaces\WorkerProtocolInterface;
use TamerLib\Abstracts\ProtocolType;
use TamerLib\Interfaces\ClientProtocolInterface;
use TamerLib\Interfaces\WorkerProtocolInterface;
class Functions
{
@ -60,8 +60,8 @@
/** @noinspection PhpFullyQualifiedNameUsageInspection */
return match (strtolower($protocol))
{
ProtocolType::Gearman => new \Tamer\Protocols\Gearman\Client($username, $password),
ProtocolType::RabbitMQ => new \Tamer\Protocols\RabbitMq\Client($username, $password),
ProtocolType::Gearman => new \TamerLib\Protocols\Gearman\Client($username, $password),
ProtocolType::RabbitMQ => new \TamerLib\Protocols\RabbitMq\Client($username, $password),
default => throw new InvalidArgumentException('Invalid protocol type'),
};
}
@ -77,8 +77,8 @@
/** @noinspection PhpFullyQualifiedNameUsageInspection */
return match (strtolower($protocol))
{
ProtocolType::Gearman => new \Tamer\Protocols\Gearman\Worker($username, $password),
ProtocolType::RabbitMQ => new \Tamer\Protocols\RabbitMq\Worker($username, $password),
ProtocolType::Gearman => new \TamerLib\Protocols\Gearman\Worker($username, $password),
ProtocolType::RabbitMQ => new \TamerLib\Protocols\RabbitMq\Worker($username, $password),
default => throw new InvalidArgumentException('Invalid protocol type'),
};
}

View file

@ -2,12 +2,12 @@
/** @noinspection PhpMissingFieldTypeInspection */
namespace Tamer\Classes;
namespace TamerLib\Classes;
use Exception;
use LogLib\Log;
use Symfony\Component\Process\Process;
use Tamer\Objects\WorkerInstance;
use TamerLib\Objects\WorkerInstance;
class Supervisor
{

View file

@ -1,10 +1,10 @@
<?php
namespace Tamer\Classes;
namespace TamerLib\Classes;
use Tamer\Abstracts\Mode;
use Tamer\Abstracts\ProtocolType;
use Tamer\Abstracts\TaskPriority;
use TamerLib\Abstracts\Mode;
use TamerLib\Abstracts\ProtocolType;
use TamerLib\Abstracts\TaskPriority;
class Validate
{

View file

@ -1,6 +1,6 @@
<?php
namespace Tamer\Exceptions;
namespace TamerLib\Exceptions;
use Exception;
use Throwable;

View file

@ -1,6 +1,6 @@
<?php
namespace Tamer\Exceptions;
namespace TamerLib\Exceptions;
use Exception;
use Throwable;

View file

@ -1,10 +1,10 @@
<?php
namespace Tamer\Interfaces;
namespace TamerLib\Interfaces;
use Closure;
use Tamer\Exceptions\ConnectionException;
use Tamer\Objects\Task;
use TamerLib\Exceptions\ConnectionException;
use TamerLib\Objects\Task;
interface ClientProtocolInterface
{

View file

@ -1,8 +1,8 @@
<?php
namespace Tamer\Interfaces;
namespace TamerLib\Interfaces;
use Tamer\Exceptions\ConnectionException;
use TamerLib\Exceptions\ConnectionException;
interface WorkerProtocolInterface
{

View file

@ -2,7 +2,7 @@
/** @noinspection PhpMissingFieldTypeInspection */
namespace Tamer\Objects;
namespace TamerLib\Objects;
use Closure;
use Opis\Closure\SerializableClosure;

View file

@ -2,9 +2,9 @@
/** @noinspection PhpMissingFieldTypeInspection */
namespace Tamer\Objects;
namespace TamerLib\Objects;
use Tamer\Abstracts\JobStatus;
use TamerLib\Abstracts\JobStatus;
class JobResults
{

View file

@ -2,12 +2,12 @@
/** @noinspection PhpMissingFieldTypeInspection */
namespace Tamer\Objects;
namespace TamerLib\Objects;
use Closure;
use InvalidArgumentException;
use Tamer\Abstracts\TaskPriority;
use Tamer\Classes\Validate;
use TamerLib\Abstracts\TaskPriority;
use TamerLib\Classes\Validate;
class Task
{

View file

@ -2,12 +2,12 @@
/** @noinspection PhpMissingFieldTypeInspection */
namespace Tamer\Objects;
namespace TamerLib\Objects;
use Exception;
use LogLib\Log;
use Symfony\Component\Process\Process;
use Tamer\Classes\Functions;
use TamerLib\Classes\Functions;
class WorkerInstance
{

View file

@ -3,11 +3,11 @@
require 'ncc';
import('net.nosial.tamerlib', 'latest');
\Tamer\Tamer::initWorker();
\TamerLib\Tamer::initWorker();
try
{
\Tamer\Tamer::work();
\TamerLib\Tamer::work();
}
catch(\Exception $e)
{

View file

@ -2,19 +2,19 @@
/** @noinspection PhpMissingFieldTypeInspection */
namespace Tamer\Protocols\Gearman;
namespace TamerLib\Protocols\Gearman;
use Closure;
use Exception;
use GearmanClient;
use GearmanTask;
use LogLib\Log;
use Tamer\Abstracts\TaskPriority;
use Tamer\Exceptions\ConnectionException;
use Tamer\Interfaces\ClientProtocolInterface;
use Tamer\Objects\Job;
use Tamer\Objects\JobResults;
use Tamer\Objects\Task;
use TamerLib\Abstracts\TaskPriority;
use TamerLib\Exceptions\ConnectionException;
use TamerLib\Interfaces\ClientProtocolInterface;
use TamerLib\Objects\Job;
use TamerLib\Objects\JobResults;
use TamerLib\Objects\Task;
class Client implements ClientProtocolInterface
{

View file

@ -2,18 +2,18 @@
/** @noinspection PhpMissingFieldTypeInspection */
namespace Tamer\Protocols\Gearman;
namespace TamerLib\Protocols\Gearman;
use Exception;
use GearmanJob;
use GearmanWorker;
use LogLib\Log;
use Opis\Closure\SerializableClosure;
use Tamer\Abstracts\JobStatus;
use Tamer\Exceptions\ConnectionException;
use Tamer\Interfaces\WorkerProtocolInterface;
use Tamer\Objects\Job;
use Tamer\Objects\JobResults;
use TamerLib\Abstracts\JobStatus;
use TamerLib\Exceptions\ConnectionException;
use TamerLib\Interfaces\WorkerProtocolInterface;
use TamerLib\Objects\Job;
use TamerLib\Objects\JobResults;
class Worker implements WorkerProtocolInterface
{

View file

@ -2,19 +2,19 @@
/** @noinspection PhpMissingFieldTypeInspection */
namespace Tamer\Protocols\RabbitMq;
namespace TamerLib\Protocols\RabbitMq;
use Closure;
use Exception;
use PhpAmqpLib\Channel\AMQPChannel;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
use Tamer\Abstracts\TaskPriority;
use Tamer\Exceptions\ServerException;
use Tamer\Interfaces\ClientProtocolInterface;
use Tamer\Objects\Job;
use Tamer\Objects\JobResults;
use Tamer\Objects\Task;
use TamerLib\Abstracts\TaskPriority;
use TamerLib\Exceptions\ServerException;
use TamerLib\Interfaces\ClientProtocolInterface;
use TamerLib\Objects\Job;
use TamerLib\Objects\JobResults;
use TamerLib\Objects\Task;
class Client implements ClientProtocolInterface
{

View file

@ -2,16 +2,16 @@
/** @noinspection PhpMissingFieldTypeInspection */
namespace Tamer\Protocols\RabbitMq;
namespace TamerLib\Protocols\RabbitMq;
use Exception;
use PhpAmqpLib\Channel\AMQPChannel;
use PhpAmqpLib\Connection\AMQPStreamConnection;
use PhpAmqpLib\Message\AMQPMessage;
use Tamer\Abstracts\JobStatus;
use Tamer\Interfaces\WorkerProtocolInterface;
use Tamer\Objects\Job;
use Tamer\Objects\JobResults;
use TamerLib\Abstracts\JobStatus;
use TamerLib\Interfaces\WorkerProtocolInterface;
use TamerLib\Objects\Job;
use TamerLib\Objects\JobResults;
class Worker implements WorkerProtocolInterface
{

View file

@ -2,20 +2,20 @@
/** @noinspection PhpMissingFieldTypeInspection */
namespace Tamer;
namespace TamerLib;
use Closure;
use Exception;
use InvalidArgumentException;
use Tamer\Abstracts\Mode;
use Tamer\Classes\Functions;
use Tamer\Classes\Supervisor;
use Tamer\Classes\Validate;
use Tamer\Exceptions\ConnectionException;
use Tamer\Exceptions\UnsupervisedWorkerException;
use Tamer\Interfaces\ClientProtocolInterface;
use Tamer\Interfaces\WorkerProtocolInterface;
use Tamer\Objects\Task;
use TamerLib\Abstracts\Mode;
use TamerLib\Classes\Functions;
use TamerLib\Classes\Supervisor;
use TamerLib\Classes\Validate;
use TamerLib\Exceptions\ConnectionException;
use TamerLib\Exceptions\UnsupervisedWorkerException;
use TamerLib\Interfaces\ClientProtocolInterface;
use TamerLib\Interfaces\WorkerProtocolInterface;
use TamerLib\Objects\Task;
class Tamer
{

View file

@ -1,8 +1,8 @@
<?php
use Tamer\Abstracts\ProtocolType;
use Tamer\Tamer;
use TamerLib\Abstracts\ProtocolType;
use TamerLib\Tamer;
require 'ncc';

View file

@ -1,9 +1,9 @@
<?php
use Tamer\Abstracts\ProtocolType;
use Tamer\Objects\JobResults;
use Tamer\Objects\Task;
use Tamer\Tamer;
use TamerLib\Abstracts\ProtocolType;
use TamerLib\Objects\JobResults;
use TamerLib\Objects\Task;
use TamerLib\Tamer;
require 'ncc';

View file

@ -1,8 +1,8 @@
<?php
use Tamer\Abstracts\Mode;
use Tamer\Abstracts\ProtocolType;
use Tamer\Tamer;
use TamerLib\Abstracts\Mode;
use TamerLib\Abstracts\ProtocolType;
use TamerLib\Tamer;
require 'ncc';
@ -10,7 +10,7 @@
Tamer::initWorker();
Tamer::addFunction('sleep', function(\Tamer\Objects\Job $job) {
Tamer::addFunction('sleep', function(\TamerLib\Objects\Job $job) {
sleep($job->getData());
return $job->getData();
});