modifs.mineures sans commentaires
This commit is contained in:
		
							parent
							
								
									907f17af33
								
							
						
					
					
						commit
						207d17a749
					
				@ -3,45 +3,45 @@ namespace nur\sery\db;
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Class Capacitor: un objet permettant d'attaquer un canal spécique d'une
 | 
					 * Class Capacitor: un objet permettant d'attaquer un canal spécique d'une
 | 
				
			||||||
 * instance de {@link AbstractCapacitor}
 | 
					 * instance de {@link CapacitorStorage}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class Capacitor {
 | 
					class Capacitor {
 | 
				
			||||||
  function __construct(AbstractCapacitor $capacitor, CapacitorChannel $channel) {
 | 
					  function __construct(CapacitorStorage $storage, CapacitorChannel $channel) {
 | 
				
			||||||
    $this->capacitor = $capacitor;
 | 
					    $this->storage = $storage;
 | 
				
			||||||
    $this->channel = $channel;
 | 
					    $this->channel = $channel;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /** @var AbstractCapacitor */
 | 
					  /** @var CapacitorStorage */
 | 
				
			||||||
  protected $capacitor;
 | 
					  protected $storage;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  /** @var CapacitorChannel */
 | 
					  /** @var CapacitorChannel */
 | 
				
			||||||
  protected $channel;
 | 
					  protected $channel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function exists(): bool {
 | 
					  function exists(): bool {
 | 
				
			||||||
    return $this->capacitor->_exists($this->channel);
 | 
					    return $this->storage->_exists($this->channel);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function reset(): void {
 | 
					  function reset(): void {
 | 
				
			||||||
    $this->capacitor->_reset($this->channel);
 | 
					    $this->storage->_reset($this->channel);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function charge($item, ?callable $func=null, ?array $args=null): bool {
 | 
					  function charge($item, ?callable $func=null, ?array $args=null): bool {
 | 
				
			||||||
    return $this->capacitor->_charge($this->channel, $item, $func, $args);
 | 
					    return $this->storage->_charge($this->channel, $item, $func, $args);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function discharge($filter=null, ?bool $reset=null): iterable {
 | 
					  function discharge($filter=null, ?bool $reset=null): iterable {
 | 
				
			||||||
    return $this->capacitor->_discharge($this->channel, $filter, $reset);
 | 
					    return $this->storage->_discharge($this->channel, $filter, $reset);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function get($filter) {
 | 
					  function get($filter) {
 | 
				
			||||||
    return $this->capacitor->_get($this->channel, $filter);
 | 
					    return $this->storage->_get($this->channel, $filter);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function each($filter, callable $func, ?array $args=null): void {
 | 
					  function each($filter, callable $func, ?array $args=null): void {
 | 
				
			||||||
    $this->capacitor->_each($this->channel, $filter, $func, $args);
 | 
					    $this->storage->_each($this->channel, $filter, $func, $args);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  function close(): void {
 | 
					  function close(): void {
 | 
				
			||||||
    $this->capacitor->close();
 | 
					    $this->storage->close();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
@ -4,7 +4,7 @@ namespace nur\sery\db;
 | 
				
			|||||||
/**
 | 
					/**
 | 
				
			||||||
 * Class AbstractCapacitor: implémentation de base d'un {@link ICapacitor}
 | 
					 * Class AbstractCapacitor: implémentation de base d'un {@link ICapacitor}
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
abstract class AbstractCapacitor implements ICapacitor {
 | 
					abstract class CapacitorStorage implements ICapacitor {
 | 
				
			||||||
  abstract protected function getChannel(?string $name): CapacitorChannel;
 | 
					  abstract protected function getChannel(?string $name): CapacitorChannel;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  abstract function _exists(CapacitorChannel $channel): bool;
 | 
					  abstract function _exists(CapacitorChannel $channel): bool;
 | 
				
			||||||
@ -2,15 +2,15 @@
 | 
				
			|||||||
namespace nur\sery\db\sqlite;
 | 
					namespace nur\sery\db\sqlite;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
use nur\sery\cl;
 | 
					use nur\sery\cl;
 | 
				
			||||||
use nur\sery\db\AbstractCapacitor;
 | 
					 | 
				
			||||||
use nur\sery\db\CapacitorChannel;
 | 
					use nur\sery\db\CapacitorChannel;
 | 
				
			||||||
 | 
					use nur\sery\db\CapacitorStorage;
 | 
				
			||||||
use nur\sery\php\func;
 | 
					use nur\sery\php\func;
 | 
				
			||||||
use nur\sery\ValueException;
 | 
					use nur\sery\ValueException;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * Class SqliteCapacitor
 | 
					 * Class SqliteCapacitor
 | 
				
			||||||
 */
 | 
					 */
 | 
				
			||||||
class SqliteCapacitor extends AbstractCapacitor{
 | 
					class SqliteCapacitor extends CapacitorStorage {
 | 
				
			||||||
  function __construct($sqlite) {
 | 
					  function __construct($sqlite) {
 | 
				
			||||||
    $this->sqlite = Sqlite::with($sqlite);
 | 
					    $this->sqlite = Sqlite::with($sqlite);
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user