function __construct($title = null, $block = false) { Assert::isScalarOrNull($title); Assert::isBoolean($block); $this->title = $title; $this->block = $block; }
/** * @return DoctypeDeclaration **/ public function setPublic($isPublic) { Assert::isBoolean($isPublic); $this->public = $isPublic; $this->inline = false; return $this; }
/** * @param boolean whether to use include path or not * @param boolean whether to allow pre-scanning technique or not. PreScan is important for * huge and distributed class locations */ function __construct($useIncludePath = true, $allowPreScan = false) { Assert::isBoolean($allowPreScan); $this->allowPreScan = $allowPreScan; parent::__construct($useIncludePath); $this->setExtension(PHOEBIUS_TYPE_EXTENSION); }
function getParameterList($requiredOnly = true) { Assert::isBoolean($requiredOnly); if ($requiredOnly && $this->isOptional) { return array(); } return array($this->name); }
public function __construct(Identifiable $parent, GenericDAO $dao, $lazy = true) { Assert::isBoolean($lazy); $this->parent = $parent; $this->lazy = $lazy; $this->dao = $dao; Assert::isInstance($dao->getObjectName(), 'Identifiable'); $this->comparator = SerializedObjectComparator::me(); }
/** * Performs validation against custom parameters (convention, and even processor). * Please consider, how methods with the long list of arguments are formatted. * @param $target object to validate * @param $somethingElse boolean something else argument * @return CodingStyleValidator itself */ function validateAgainstCustom(IConvention $convention, CodingStyleProcessor $processor, $target, $somethingElse = true) { // do not forget to check custom arguments against their expected type Assert::isTrue(is_object($target)); Assert::isBoolean($somethingElse); $this->convention = $convention; $this->processor = $processor->setTarget($target)->setSomethingElse($somethingElse); $this->runValidation(); return $this; }
/** * @param string $filepath path to the file that should be presented in response * @param string $filename optional name of the file to be specified in the response * @param string $contentType optional content type of the file to be specified in the response * @param boolean $unlinkOnFinish whether to remove the file when response is finished */ function __construct($filepath, $filename = null, $contentType = null, $unlinkOnFinish = false) { Assert::isTrue(is_file($filepath)); Assert::isScalarOrNull($filename); Assert::isScalarOrNull($contentType); Assert::isBoolean($unlinkOnFinish); $this->filepath = $filepath; $this->filename = $filename ? $filename : basename($filepath); $this->contentType = $contentType; $this->unlinkOnFileFlush = $unlinkOnFinish; }
/** * @param string $name name of the property * @param array list of database field names * @param OrmPropertyType property type * @param false property visibility * @param boolean whether the property unique or not */ function __construct($name, array $fields, OrmPropertyType $type, OrmPropertyVisibility $visibility, AssociationMultiplicity $multiplicity, $isUnique = false, $isIdentifier = false) { Assert::isScalar($name); Assert::isBoolean($isUnique); Assert::isBoolean($isIdentifier); $this->name = $name; Assert::isTrue(sizeof($fields) == $type->getColumnCount(), 'wrong DB field count'); $this->fields = $fields; $this->type = $type; $this->visibility = $visibility; $this->multiplicity = $multiplicity; $this->isUnique = $isUnique; $this->isIdentifier = $isIdentifier; }
/** * @return RedirectView **/ public function setBuildArrays($really) { Assert::isBoolean($really); $this->buildArrays = $really; return $this; }
/** * Resolves the file path containing the requested class. Firstly, searches withing the cache * provided by {@link InternalSegmentCache}, then invokes the path scanner and comparer * provided by a descendant class * @param string $classname * @param boolean $checkIfExists * @return string|null returns the absolute path to the file containing the requested class * or NULL if such file not found */ private function resolveClassPath($classname, $checkIfExists, $useCacheOnly = false) { Assert::isScalar($classname); Assert::isBoolean($checkIfExists); if (isset($this->foundClasspaths[$classname])) { return $this->foundClasspaths[$classname]; } $classpath = null; if ($this->isCached($classname)) { $classpath = $this->getCached($classname); if ($checkIfExists && $classpath) { if (!file_exists($classpath)) { $this->uncache($classname); $classpath = null; } } } if (!$classpath && !$useCacheOnly) { $classpath = $this->scanClassPaths($classname); if ($classpath) { $this->cache($classname, $classpath); } } if ($classpath) { $this->foundClasspaths[$classname] = $classpath; } return $classpath; }
function getSqlBooleanValue($value) { Assert::isBoolean($value); return $value ? 't' : 'f'; }
public function setOverlapped($overlapped = true) { Assert::isBoolean($overlapped); $this->overlapped = $overlapped === true; return $this; }
/** * @param $really boolean * @return CurlHttpClient **/ public function setNoBody($really) { Assert::isBoolean($really); $this->noBody = $really; return $this; }
private function invokeResolvers($classname, $useCacheOnly) { Assert::isBoolean($useCacheOnly); foreach ($this->resolvers as $resolver) { $result = $resolver->loadClassFile($classname, $useCacheOnly); if ($result && ($classpath = $resolver->getClassPath($classname, true))) { $this->classPaths[] = $classpath; break; } } return TypeUtils::isDefined($classname); }
/** * @return HtmlTokenizer **/ public function lowercaseTags($isLowercaseTags) { Assert::isBoolean($isLowercaseTags); $this->lowercaseTags = $isLowercaseTags; return $this; }
function getSqlBooleanValue($value) { Assert::isBoolean($value); return $value ? 1 : 0; }
/** * @return Criteria **/ public function fetchCollection($path, $lazy = false, $criteria = null) { Assert::isBoolean($lazy); Assert::isTrue($criteria === null || $criteria instanceof Criteria); $this->collections[$path]['lazy'] = $lazy; $this->collections[$path]['criteria'] = $criteria; $this->collections[$path]['propertyPath'] = new PropertyPath($this->checkAndGetDao()->getObjectName(), $path); return $this; }
function setImportTrim($flag = true) { Assert::isBoolean($flag); $this->trim = $flag; return $this; }
function __construct(IdentifiableOrmEntity $parent, IQueryable $children, $readOnly = true) { Assert::isBoolean($readOnly); Assert::isTrue(!!$parent->getId(), 'cannot track children of unsaved parent'); $this->parent = $parent; $this->children = $children; $this->readOnly = $readOnly; $this->query = new EntityQuery($this->children); }
function getExtension($includeDot = false) { Assert::isBoolean($includeDot); if ($this->type == IMAGETYPE_JPEG || $this->type == IMAGETYPE_JPEG2000) { return ($includeDot ? '.' : '') . 'jpg'; } else { return image_type_to_extension($this->type, $includeDot); } }
/** * Sets whether entity is DAO-related * * @param boolean $flag * * @return OrmClass itself */ function setHasDao($flag) { Assert::isBoolean($flag); $this->hasDao = $flag; return $this; }
/** * Sets the query to eliminate duplicate rows from the result * * @return SelectQuery */ function setDistinct($flag = true) { Assert::isBoolean($flag); $this->distinct = $flag; return $this; }
/** * Gets the <option> tag as string * @param $value * @param $selected * @return string */ protected function getOption($value, $selected) { Assert::isScalarOrNull($value); Assert::isBoolean($selected); $attributes = array(); if ($value) { $attributes['value'] = $value; } if ($selected) { $attributes['selected'] = 'selected'; } return HtmlUtil::getContainer('option', $attributes, $this->getLabelFor($value)); }
/** * @param boolean whether to use include path. Default it true. */ function __construct($useIncludePath = true) { Assert::isBoolean($useIncludePath); $this->useIncludePath = $useIncludePath; }
/** * Defines the type as nullable or not, if possible * * @param boolean $flag * * @return DBType */ function setIsNullable($flag) { Assert::isBoolean($flag); $this->isNullable = $flag; return $this; }
/** * Specifies what to do with errors that do not match the cover mask. If you wish to supress * them and let the default handler to process those errors than you can set this argument to * false. * @param boolean $supressUncovered specifies what to do with errors that do not match the * cover mask. If you wish to supress them and let the default handler to process those errors * than you can set this argument to false. * @return Exceptionizer itself */ function setUncoveredErrorsIgnorance($flag = false) { Assert::isBoolean($flag); $this->supressUncovered = $flag; return $this; }
function __construct($useHtml = true) { Assert::isBoolean($useHtml); $this->useHtml = $useHtml; }
function setImportEmpty($flag = true) { Assert::isBoolean($flag); $this->importEmpty = $flag; return $this; }
/** * @throws DBQueryException * @param ISqlQUery $query * @param boolean $isAsync * @return resource */ protected function performQuery(ISqlQuery $query, $isAsync) { Assert::isBoolean($isAsync); $parameters = $query->getPlaceholderValues($this->getDialect()); $queryAsString = $query->toDialectString($this->getDialect()); if ($isAsync) { LoggerPool::log(parent::LOG_VERBOSE, 'sending an async query: %s', $queryAsString); } else { LoggerPool::log(parent::LOG_VERBOSE, 'sending query: %s', $queryAsString); } LoggerPool::log(parent::LOG_QUERY, $queryAsString); $executeResult = pg_send_query($this->link, $queryAsString); if (!$isAsync || !$executeResult) { $result = pg_get_result($this->link); $resultStatus = pg_result_status($result, PGSQL_STATUS_LONG); if (in_array($resultStatus, array(PGSQL_EMPTY_QUERY, PGSQL_BAD_RESPONSE, PGSQL_NONFATAL_ERROR, PGSQL_FATAL_ERROR))) { $errorCode = pg_result_error_field($result, PGSQL_DIAG_SQLSTATE); $errorMessage = pg_result_error_field($result, PGSQL_DIAG_MESSAGE_PRIMARY); if (PgSqlError::UNIQUE_VIOLATION == $errorCode) { LoggerPool::log(parent::LOG_VERBOSE, 'query caused a unique violation: %s', $errorMessage); throw new UniqueViolationException($query, $errorMessage); } else { LoggerPool::log(parent::LOG_VERBOSE, 'query caused an error #%s: %s', $errorCode, $errorMessage); throw new PgSqlQueryException($query, $errorMessage, $errorCode); } } } return $result; }
/** * @return Cdata **/ public function setStrict($isStrict) { Assert::isBoolean($isStrict); $this->strict = $isStrict; return $this; }