modifs.mineures sans commentaires
This commit is contained in:
		
							parent
							
								
									3759f10fa0
								
							
						
					
					
						commit
						dc020a1a31
					
				@ -15,4 +15,37 @@ namespace nur\sery\wip\php\access;
 | 
			
		||||
 * {@link IGetter} attaquent de nouveau $reader comme initialement
 | 
			
		||||
 */
 | 
			
		||||
class DoubleAccess extends AbstractAccess {
 | 
			
		||||
  function __construct(IAccess $reader, IAccess $writer) {
 | 
			
		||||
    $this->reader = $reader;
 | 
			
		||||
    $this->writer = $writer;
 | 
			
		||||
    $this->getter = $reader;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  protected IAccess $reader;
 | 
			
		||||
 | 
			
		||||
  protected IAccess $writer;
 | 
			
		||||
 | 
			
		||||
  protected IGetter $getter;
 | 
			
		||||
 | 
			
		||||
  function exists(): bool {
 | 
			
		||||
    return $this->getter->exists();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function available(): bool {
 | 
			
		||||
    return $this->getter->available();
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function get($default=null) {
 | 
			
		||||
    return $this->getter->get($default);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  function set($value): void {
 | 
			
		||||
    $this->writer->set($value);
 | 
			
		||||
    $this->getter = $this->writer;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  public function del(): void {
 | 
			
		||||
    $this->writer->del();
 | 
			
		||||
    $this->getter = $this->reader;
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user