public function __construct($min = 0, $max = 1, $step = 1) { parent::__construct($min, $max); if (!is_int($step)) { $this->setType(NumberGeneratorInterface::TYPE_FLOAT); } $this->step = $step; }
function __construct($toMock) { parent::__construct($toMock); //ensure the given mock is an interface if (!$this->getToMock()->isInterface()) { throw new GeneratorException(sprintf("The interface to mock %s is not a interface", $toMock)); } }
/** * Constructor. * * @param string $inClassName * @param string $inSourceFile * @param string $outClassName * @param string $outSourceFile * @throws \RuntimeException */ public function __construct($inClassName, $inSourceFile = '', $outClassName = '', $outSourceFile = '') { if (empty($inSourceFile)) { $inSourceFile = $inClassName . '.php'; } if (!is_file($inSourceFile)) { throw new \RuntimeException(sprintf('"%s" could not be opened.', $inSourceFile)); } if (empty($outClassName)) { $outClassName = substr($inClassName, 0, strlen($inClassName) - 4); } if (empty($outSourceFile)) { $outSourceFile = dirname($inSourceFile) . DIRECTORY_SEPARATOR . $outClassName . '.php'; } parent::__construct($inClassName, $inSourceFile, $outClassName, $outSourceFile); }
/** * Creates instance of geneartor * * @param string $toMock The type of object that needs to be extended * @throws GeneratorException * @internal param string $name Then name of the of the generated class */ function __construct($toMock) { parent::__construct($toMock); //ensure the class is not final if ($this->getToMock()->isFinal()) { throw new GeneratorException(sprintf('Unable to create proxy for %s because its final', $toMock)); } //ensure toMock can be extended if ($this->getToMock()->isInterface()) { throw new GeneratorException(sprintf('Unable to create proxy for %s because its not instantiable or abstract', $toMock)); } $constructor = $this->getToMock()->getConstructor(); if ($constructor != null && $constructor->getNumberOfRequiredParameters() > 0) { throw new GeneratorException(sprintf("Unable to create proxy for %s becuase the constructor has required parameters", $toMock)); } }
/** * PropertyGenerator constructor. * * @param string $name Property name * @param mixed $value Property value * @param AbstractGenerator|null $parent Parent generator */ public function __construct(string $name, $value = null, AbstractGenerator $parent = null) { $this->name = $name; $this->value = $this->parseValue($value); parent::__construct($parent); }
/** * {@inheritDoc} */ public function __construct($binary = null, array $options = array(), array $env = null) { $this->setDefaultExtension('pdf'); $this->setOptionsWithContentCheck(); parent::__construct($binary, $options, $env); }
/** * ClassGenerator constructor. * * @param string $className * @param string $testCaseClassName * @param string $testDirectoryName * @param string $sourceFile * @param string $targetClassName * @param string $targetSourceFile */ public function __construct($className, $testCaseClassName, $testDirectoryName, $sourceFile = '', $targetClassName = '', $targetSourceFile = '') { $this->testCaseClassName = $testCaseClassName; parent::__construct($className, $testDirectoryName, $sourceFile, $targetClassName, $targetSourceFile); }
/** * FunctionGenerator constructor. * * @param string $name Function name * @param AbstractGenerator $parent Parent Generator */ public function __construct(string $name, AbstractGenerator $parent = null) { $this->name = $name; parent::__construct($parent); }
public function __construct($container, $entityName, $templatePath, $fileName, $rootFolder, $prefix = null, $parentEntity = null, $viewType, $additionalParams = []) { parent::__construct($container, $entityName, $templatePath, $fileName, $rootFolder, $prefix, $parentEntity); $this->viewType = $viewType; $this->additionalParams = $additionalParams; }
public function __construct(NumberGeneratorInterface $weightGenerator, $min, $max) { parent::__construct($min, $max); $this->weightGenerator = $weightGenerator; $this->evaluateWeights(); }
/** * @param string path to coverage.dat file * @param string path to source file/directory * @param string */ public function __construct($file, $source = NULL, $title = NULL) { parent::__construct($file, $source); $this->title = $title; }
/** * Constructor. * * @param string $inClassName * @param string $inSourceFile * @param string $outClassName * @param string $outSourceFile * @throws \RuntimeException */ public function __construct($inClassName, $inSourceFile = '', $outClassName = '', $outSourceFile = '') { if (class_exists($inClassName)) { $reflector = new \ReflectionClass($inClassName); $inSourceFile = $reflector->getFileName(); if ($inSourceFile === false) { $inSourceFile = '<internal>'; } unset($reflector); } else { if (empty($inSourceFile)) { $possibleFilenames = array($inClassName . '.php', str_replace(array('_', '\\'), DIRECTORY_SEPARATOR, $inClassName) . '.php'); foreach ($possibleFilenames as $possibleFilename) { if (is_file($possibleFilename)) { $inSourceFile = $possibleFilename; } } } if (empty($inSourceFile)) { throw new \RuntimeException(sprintf('Neither "%s" nor "%s" could be opened.', $possibleFilenames[0], $possibleFilenames[1])); } if (!is_file($inSourceFile)) { throw new \RuntimeException(sprintf('"%s" could not be opened.', $inSourceFile)); } $inSourceFile = realpath($inSourceFile); include_once $inSourceFile; if (!class_exists($inClassName)) { throw new \RuntimeException(sprintf('Could not find class "%s" in "%s".', $inClassName, $inSourceFile)); } } if (empty($outClassName)) { $outClassName = $inClassName . 'Test'; } if (empty($outSourceFile)) { $outSourceFile = dirname($inSourceFile) . DIRECTORY_SEPARATOR . $outClassName . '.php'; } parent::__construct($inClassName, $inSourceFile, $outClassName, $outSourceFile); }
/** * {@inheritDoc} */ public function __construct(array $global_options = [], array $object_options = []) { $this->setDefaultExtension('pdf'); parent::__construct($global_options, $object_options); }
/** * {@inheritDoc} */ public function __construct($binary = null, array $options = array(), array $env = null) { $this->setDefaultExtension('jpg'); parent::__construct($binary, $options, $env); }
/** * ClassGenerator constructor. * * @param string $className Class name * @param GenericGenerator $parent Parent generator */ public function __construct(string $className, GenericGenerator $parent = null) { $this->className = $className; parent::__construct($parent); }
/** * {@inheritDoc} */ public function __construct($binary = null, array $options = array()) { $this->setDefaultExtension('pdf'); parent::__construct($binary, $options); }
/** * {@inheritDoc} */ public function __construct(array $options = array()) { $this->setDefaultExtension('jpg'); parent::__construct($options); }