- Removed tmp file from phpstorm
This commit is contained in:
		
							parent
							
								
									d08d1f0fe7
								
							
						
					
					
						commit
						9070bf3862
					
				@ -1,27 +0,0 @@
 | 
				
			|||||||
<?php
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace Mcnd\CLI\Option;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class CountOption extends ParsedOption
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    protected int $count = 0;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function toggle() : void
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->count++;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getValue() : null|int
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->count ?: null;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setValue(mixed $value) : void
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        if ( ! is_int($value) ) {
 | 
					 | 
				
			||||||
            throw new \RuntimeException("A value was given to an option (%s) which is countable");
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->count = $value;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
@ -1,25 +0,0 @@
 | 
				
			|||||||
<?php
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
namespace Mcnd\CLI\Option;
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
class KeyValueOption extends ParsedOption
 | 
					 | 
				
			||||||
{
 | 
					 | 
				
			||||||
    protected array $values = [];
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setValue(string $key, string $value) : void
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        $this->values[$key] = $value;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function setRawValue(string $value) : void
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        list($key, $value) = explode('=', trim($value), 2);
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
        $this->setValue($key, $value);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
    public function getValue() : null|array
 | 
					 | 
				
			||||||
    {
 | 
					 | 
				
			||||||
        return $this->values ?: null;
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
}
 | 
					 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user