/** * Creates the factory to wrap the platform-specific factory. * * @api * @param \Icecave\Isolator\Isolator $isolator The isolator object to * override environment variable lookup. */ public function __construct(Isolator $isolator = null) { if ($isolator ? $isolator->defined('PHP_WINDOWS_VERSION_BUILD') : defined('PHP_WINDOWS_VERSION_BUILD')) { $this->_platformFactory = new WindowsLocatorFactory(); } else { $this->_platformFactory = new PosixLocatorFactory(); } }
/** * Loads the given KML file * * @param string $kmlFilename The file to be loaded * @param string $regionName The name of the region. If omitted the filename will be used as the region name * * @return boolean Success */ public function loadRegion($kmlFilename, $regionName = null) { $data = null; if ($this->php->file_exists($kmlFilename)) { $data = $this->php->file_get_contents($kmlFilename); } if (!$data) { throw new GeoDataException("Error reading file {$kmlFilename}", 4002); } if (!$regionName) { $regionName = $this->php->basename($kmlFilename, '.kml'); } return $this->loadRegionData($data, $regionName); }
/** * @param Renderer|null $renderer * @param ParameterListParser|null $parser * @param ParameterListGenerator|null $generator * @param ClassMapper|null $classMapper * @param ParameterListMerge\MergeTool|null $mergeTool * @param Isolator|null $isolator */ public function __construct(Renderer $renderer = null, ParameterListParser $parser = null, ParameterListGenerator $generator = null, ClassMapper $classMapper = null, ParameterListMerge\MergeTool $mergeTool = null, Isolator $isolator = null) { $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args()); if (null === $renderer) { $renderer = new Renderer(); } if (null === $parser) { $parser = new ParameterListParser(); } if (null === $generator) { $generator = new ParameterListGenerator(); } if (null === $classMapper) { $classMapper = new ClassMapper(); } if (null === $mergeTool) { $mergeTool = new ParameterListMerge\MergeTool(); } $this->renderer = $renderer; $this->parser = $parser; $this->generator = $generator; $this->classMapper = $classMapper; $this->mergeTool = $mergeTool; $this->isolator = Isolator::get($isolator); }
/** * Construct a new configuration reader. * * @param ConfigurationValidator|null $validator The validator to use. * @param Isolator|null $isolator The isolator to use. */ public function __construct(ConfigurationValidator $validator = null, Isolator $isolator = null) { if (null === $validator) { $validator = new ConfigurationValidator(); } $this->validator = $validator; $this->isolator = Isolator::get($isolator); }
/** * @param ExtensionTypeMap|null $extensionMap * @param Isolator|null $isolator */ public function __construct(ExtensionTypeMap $extensionMap = null, Isolator $isolator = null) { if (null === $extensionMap) { $extensionMap = new ExtensionTypeMap(); } $this->extensionMap = $extensionMap; $this->isolator = Isolator::get($isolator); }
/** * Construct a new fixture reader. * * @param Parser|null $parser The YAML parser to use. * @param Isolator|null $isolator THe isolator to use. */ public function __construct(Parser $parser = null, Isolator $isolator = null) { if (null === $parser) { $parser = new Parser(); } $this->parser = $parser; $this->isolator = Isolator::get($isolator); }
/** * Create a new Liftoff application. * * @param LauncherInterface|null $launcher The launcher to use. * @param Isolator|null $isolator The isolator to use. */ public function __construct(LauncherInterface $launcher = null, Isolator $isolator = null) { if (null === $launcher) { $launcher = new Launcher(); } $this->launcher = $launcher; $this->isolator = Isolator::get($isolator); }
/** * Construct a new time-based one-time password shared parameters * instance. * * @param string $secret The shared secret. * @param integer|null $time The time in seconds since the Unix epoch. * @param Isolator|null $isolator The isolator to use. */ public function __construct($secret, $time = null, Isolator $isolator = null) { if (null === $time) { $time = Isolator::get($isolator)->time(); } parent::__construct($secret); $this->time = $time; }
/** * Construct a new error handler. * * @param HandlerStackInterface|null $stack The error handler stack to use. * @param Isolator|null $isolator The isolator to use. */ public function __construct(HandlerStackInterface $stack = null, Isolator $isolator = null) { $this->isolator = Isolator::get($isolator); if (null === $stack) { $stack = new ErrorHandlerStack($isolator); } $this->setFallbackHandler(); $this->stack = $stack; }
/** * Construct a new stream handle. * * @param stream|null $stream The native stream handle, or null to create lazily from the filesystem path. * @param string|null $path The filesystem path, or null if the path is unknown. * @param Isolator|null $isolator The isolator to use. */ public function __construct($stream = null, $path = null, Isolator $isolator = null) { if (null === $stream && null === $path) { throw new Exception\EmptyHandleException(); } $this->stream = $stream; $this->path = $path; $this->isolator = Isolator::get($isolator); $this->isClosed = false; }
/** * Construct a new fatal error handler. * * @param HandlerStackInterface|null $stack The exception handler stack to use. * @param Isolator|null $isolator The isolator to use. */ public function __construct(HandlerStackInterface $stack = null, Isolator $isolator = null) { $this->isolator = Isolator::get($isolator); if (null === $stack) { $stack = new ExceptionHandlerStack($isolator); } $this->stack = $stack; $this->isRegistered = false; $this->isEnabled = false; }
/** * @param array<string,string>|null $schemeClasses * @param string|null $defaultClass * @param Isolator|null $isolator */ public function __construct(array $schemeClasses = null, $defaultClass = null, Isolator $isolator = null) { if (null === $schemeClasses) { $schemeClasses = array('data' => __NAMESPACE__ . '\\DataUri', 'file' => __NAMESPACE__ . '\\FileUri', 'http' => __NAMESPACE__ . '\\HttpUri', 'https' => __NAMESPACE__ . '\\HttpUri'); } if (null === $defaultClass) { $defaultClass = __NAMESPACE__ . '\\Uri'; } $this->schemeClasses = $schemeClasses; $this->defaultClass = $defaultClass; $this->isolator = Isolator::get($isolator); }
/** * Construct a new Grunt client. * * @param ProcessExecutor|null $processExecutor The process executor to use. * @param ExecutableFinder|null $executableFinder The executable finder to use. * @param Isolator|null $isolator The isolator to use. */ public function __construct(ProcessExecutor $processExecutor = null, ExecutableFinder $executableFinder = null, Isolator $isolator = null) { if (null === $processExecutor) { $processExecutor = new ProcessExecutor(); } if (null === $executableFinder) { $executableFinder = new ExecutableFinder(); } $this->processExecutor = $processExecutor; $this->executableFinder = $executableFinder; $this->isolator = Isolator::get($isolator); }
/** * Construct a new fixture writer. * * @param string|null $handleClassName The class name of the writable handle type to use. * @param Inline|null $renderer The YAML renderer to use. * @param Isolator|null $isolator The isolator to use. */ public function __construct($handleClassName = null, Inline $renderer = null, Isolator $isolator = null) { if (null === $handleClassName) { $handleClassName = 'Eloquent\\Fixie\\Writer\\SwitchingCompactFixtureWriteHandle'; } if (null === $renderer) { $renderer = new Inline(); } $this->handleClassName = $handleClassName; $this->renderer = $renderer; $this->isolator = Isolator::get($isolator); }
/** * Construct a new file system path factory. * * @param PathFactoryInterface|null $unixFactory The path factory to use for Unix paths. * @param PathFactoryInterface|null $windowsFactory The path factory to use for Windows paths. * @param Isolator|null $isolator The isolator to use. */ public function __construct(PathFactoryInterface $unixFactory = null, PathFactoryInterface $windowsFactory = null, Isolator $isolator = null) { if (null === $unixFactory) { $unixFactory = UnixPathFactory::instance(); } if (null === $windowsFactory) { $windowsFactory = WindowsPathFactory::instance(); } $this->unixFactory = $unixFactory; $this->windowsFactory = $windowsFactory; $this->isolator = Isolator::get($isolator); }
/** * Construct a new configuration validator. * * @param stdClass|null $schema The schema to use. * @param Validator|null $validator The JSON schema validator to use. * @param Isolator|null $isolator The isolator to use. */ public function __construct(stdClass $schema = null, Validator $validator = null, Isolator $isolator = null) { $this->isolator = Isolator::get($isolator); if (null === $schema) { $schema = $this->loadDefaultSchema(); } if (null === $validator) { $validator = new Validator(); } $this->schema = $schema; $this->validator = $validator; }
/** * Asserts that an error handling is configured in a way that is compatible * with code expecting error exceptions. * * @param Isolator|null $isolator The isolator to use. * * @throws ErrorHandlingConfigurationException If error handling is not configured correctly. */ public static function assertCompatibleHandler(Isolator $isolator = null) { $isolator = Isolator::get($isolator); $message = 'Error handling is incorrectly configured.'; try { $isolator->trigger_error($message, E_USER_NOTICE); } catch (ErrorException $e) { if ($e->getMessage() === $message && $e->getSeverity() === E_USER_NOTICE) { return; } } throw new ErrorHandlingConfigurationException(); }
/** * @param ClassMapper|null $classMapper * @param ValidatorClassGenerator|null $validatorClassGenerator * @param array<StaticClassGenerator>|null $staticClassGenerators * @param Isolator|null $isolator */ public function __construct(ClassMapper $classMapper = null, ValidatorClassGenerator $validatorClassGenerator = null, array $staticClassGenerators = null, Isolator $isolator = null) { $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args()); if (null === $classMapper) { $classMapper = new ClassMapper(); } if (null === $validatorClassGenerator) { $validatorClassGenerator = new ValidatorClassGenerator(); } if (null === $staticClassGenerators) { $staticClassGenerators = array(new FacadeGenerator(), new AbstractValidatorGenerator(), new DummyValidatorGenerator(), new TypeInspectorGenerator(), new ExceptionGenerator\UnexpectedInputExceptionGenerator(), new ExceptionGenerator\MissingArgumentExceptionGenerator(), new ExceptionGenerator\UnexpectedArgumentExceptionGenerator(), new ExceptionGenerator\UnexpectedArgumentValueExceptionGenerator()); } $this->classMapper = $classMapper; $this->validatorClassGenerator = $validatorClassGenerator; $this->staticClassGenerators = $staticClassGenerators; $this->isolator = Isolator::get($isolator); }
/** * Register Endec's native stream filters. * * @param Isolator|null $isolator The isolator to use. */ public static function registerFilters(Isolator $isolator = null) { $isolator = Isolator::get($isolator); $isolator->stream_filter_register('endec.base16-encode', 'Eloquent\\Endec\\Base16\\Base16EncodeNativeStreamFilter'); $isolator->stream_filter_register('endec.base16-decode', 'Eloquent\\Endec\\Base16\\Base16DecodeNativeStreamFilter'); $isolator->stream_filter_register('endec.base32-encode', 'Eloquent\\Endec\\Base32\\Base32EncodeNativeStreamFilter'); $isolator->stream_filter_register('endec.base32-decode', 'Eloquent\\Endec\\Base32\\Base32DecodeNativeStreamFilter'); $isolator->stream_filter_register('endec.base32hex-encode', 'Eloquent\\Endec\\Base32\\Base32HexEncodeNativeStreamFilter'); $isolator->stream_filter_register('endec.base32hex-decode', 'Eloquent\\Endec\\Base32\\Base32HexDecodeNativeStreamFilter'); $isolator->stream_filter_register('endec.base64-encode', 'Eloquent\\Endec\\Base64\\Base64EncodeNativeStreamFilter'); $isolator->stream_filter_register('endec.base64-decode', 'Eloquent\\Endec\\Base64\\Base64DecodeNativeStreamFilter'); $isolator->stream_filter_register('endec.base64mime-encode', 'Eloquent\\Endec\\Base64\\Base64MimeEncodeNativeStreamFilter'); $isolator->stream_filter_register('endec.base64mime-decode', 'Eloquent\\Endec\\Base64\\Base64MimeDecodeNativeStreamFilter'); $isolator->stream_filter_register('endec.base64url-encode', 'Eloquent\\Endec\\Base64\\Base64UrlEncodeNativeStreamFilter'); $isolator->stream_filter_register('endec.base64url-decode', 'Eloquent\\Endec\\Base64\\Base64UrlDecodeNativeStreamFilter'); $isolator->stream_filter_register('endec.uri-encode', 'Eloquent\\Endec\\Uri\\UriEncodeNativeStreamFilter'); $isolator->stream_filter_register('endec.uri-decode', 'Eloquent\\Endec\\Uri\\UriDecodeNativeStreamFilter'); }
/** * @param Isolator|null $isolator */ public function __construct(Isolator $isolator = null) { $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args()); $this->filesystemHelper = new Filesystem(); $this->isolator = Isolator::get($isolator); }
/** * @param Isolator|null $isolator */ public function __construct(Isolator $isolator = null) { $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args()); $this->isolator = Isolator::get($isolator); parent::__construct(); }
/** * Construct a new mOTP shared parameters generator. * * @param Isolator|null $isolator The isolator to use. */ public function __construct(Isolator $isolator = null) { $this->isolator = Isolator::get($isolator); }
/** * @param boolean|null $useAutoload * @param Isolator $isolator * * @return boolean */ public function exists($useAutoload = null, Isolator $isolator = null) { if (null === $useAutoload) { $useAutoload = true; } $isolator = Isolator::get($isolator); return $isolator->class_exists($this->string(), $useAutoload); }