PHP code example of logikostech / class-options
1. Go to this page and download the library: Download logikostech/class-options library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
logikostech / class-options example snippets
use Logikos\ClassOptions\ConfigurableInterface;
use Logikos\ClassOptions\ConfigurableTrait;
use Logikos\ClassOptions\OptionDefinition;
class Configurable implements ConfigurableInterface {
use ConfigurableTrait;
const OPTION_FOO = 'foo';
const OPTION_BAR = 'bar';
const OPTION_REQUIRED = 'ion());
$this->defineOption($this->intOnlyOption());
$this->defineOption($this->dateOption());
}
public function execute() {
if (!$this->validateOptions())
throw new \Exception('All self::OPTION_DATE);
$o->setValidationHook(function($value) {
$date = date_parse($value);
return $date["error_count"] === 0;
});
return $o;
}
}