Server IP : 104.21.14.103 / Your IP : 3.15.18.176 Web Server : LiteSpeed System : Linux business53.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : giankuin ( 1871) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/giankuin/khowordpress.com/wp-content/plugins/duplicator-pro/aws/Guzzle/Service/Resource/ |
Upload File : |
<?php namespace DuplicatorPro\Guzzle\Service\Resource; defined("ABSPATH") or die(""); use DuplicatorPro\Guzzle\Common\Exception\InvalidArgumentException; use DuplicatorPro\Guzzle\Service\Command\CommandInterface; /** * Factory that utilizes multiple factories for creating iterators */ class CompositeResourceIteratorFactory implements ResourceIteratorFactoryInterface { /** @var array Array of factories */ protected $factories; /** @param array $factories Array of factories used to instantiate iterators */ public function __construct(array $factories) { $this->factories = $factories; } public function build(CommandInterface $command, array $options = array()) { if (!($factory = $this->getFactory($command))) { throw new InvalidArgumentException('Iterator was not found for ' . $command->getName()); } return $factory->build($command, $options); } public function canBuild(CommandInterface $command) { return $this->getFactory($command) !== false; } /** * Add a factory to the composite factory * * @param ResourceIteratorFactoryInterface $factory Factory to add * * @return self */ public function addFactory(ResourceIteratorFactoryInterface $factory) { $this->factories[] = $factory; return $this; } /** * Get the factory that matches the command object * * @param CommandInterface $command Command retrieving the iterator for * * @return ResourceIteratorFactoryInterface|bool */ protected function getFactory(CommandInterface $command) { foreach ($this->factories as $factory) { if ($factory->canBuild($command)) { return $factory; } } return false; } }