/** * @param string $field name of the column * @param string $table optional name of the table that owns the column */ function __construct($field, $table = null) { Assert::isScalar($field); Assert::isScalarOrNull($table); $this->field = $field; $this->table = $table; }
function __construct($title = null, $block = false) { Assert::isScalarOrNull($title); Assert::isBoolean($block); $this->title = $title; $this->block = $block; }
function quoteValue($value) { Assert::isScalarOrNull($value, 'not a scalar, but %s', gettype($value)); if (is_null($value)) { return 'NULL'; } return '\'' . mysql_real_escape_string($value, $this->link) . '\''; }
function quoteValue($value) { Assert::isScalarOrNull($value); if (is_null($value)) { return 'NULL'; } return "'" . str_replace("'", "''", $value) . "'"; }
/** * @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; }
function quoteValue($value) { Assert::isScalarOrNull($value, 'not a scalar, but %s', gettype($value)); if (is_null($value)) { return 'NULL'; } if (is_bool($value)) { $value = $value ? 't' : 'f'; } return "'" . pg_escape_string($value) . "'"; }
/** * @param IQueryable $entity entity to use as base when guessing path to queried properties * @param string $alias optional table label */ function __construct(IQueryable $entity, $alias = null) { Assert::isScalarOrNull($alias); $this->entity = $entity; $this->table = $entity->getPhysicalSchema()->getTable(); $this->alias = $alias ? $alias : $this->table; $this->registeredIds[$this->table] = true; if ($alias) { $this->registeredIds[$alias] = true; } $this->joins[] = new SelectQuerySource(new AliasedSqlValueExpression(new SqlIdentifier($this->table), $alias)); }
/** * @return string */ private function getDir($class, $scope, $internalDirectory = null) { Assert::isScalarOrNull($internalDirectory); $absolutePath = array($scope, $this->getActualClassName($class)); if ($internalDirectory) { $absolutePath[] = (string) $internalDirectory; } $absolutePath = join(DIRECTORY_SEPARATOR, $absolutePath); if (!is_dir($absolutePath)) { mkdir($absolutePath, 0755, true); } Assert::isTrue(is_writable($absolutePath), 'directory %s is not writable', $absolutePath); return $absolutePath; }
/** * Sets the name of the database schema (defined within DBPool) where an entity should be * stored * * @param strign $dbSchema optional name of the database schema. NULL to set the default schema * * @return OrmClass itself */ function setDbSchema($dbSchema = null) { Assert::isScalarOrNull($dbSchema); $this->dbSchema = $dbSchema; return $this; }
/** * Smart route assembler. * * Accepts the name of the route to be assembled, URI to be used as a template for the rules. * * Example: * @code * $router->route("blogEntry", "/blog:controller/entry:action/?id"); * @endcode * * In future, the third parameter will be allowed to contain various objects that will be * smartly mapped to appropriate rules. * * @param string $name name of the route * @param string $uri URI that will be used as request variables template * @param array $parameters array of parameters to be appended to Trace * @return ChainedRouter itself */ function route($name, $uri = null, array $parameters = array()) { Assert::isScalar($name); Assert::isScalarOrNull($uri); $rules = array(); if ($uri) { $parsedUrlPattern = parse_url($uri); if (isset($parsedUrlPattern['path'])) { $rules[] = new PathRewriteRule($parsedUrlPattern['path']); } if (isset($parsedUrlPattern['query'])) { $queryStringVariables = array(); parse_str($parsedUrlPattern['query'], $queryStringVariables); foreach ($queryStringVariables as $qsVar => $qsValue) { $rules[] = new RequestVarImportRule($qsVar, new WebRequestPart(WebRequestPart::GET), !empty($qsValue), empty($qsValue) ? null : $qsValue); } } } foreach ($parameters as $parameter => $value) { $rules[] = new ParameterImportRule($parameter, $value); } $this->addRoute($name, new Route($this->defaultDispatcher, $rules)); return $this; }
/** * @return DoxyGroup */ function setVersion($version = null) { Assert::isScalarOrNull($version); $this->version = $version; return $this; }
function __construct($activeElement = null) { Assert::isScalarOrNull($activeElement); $this->activeElement = $activeElement; parent::__construct('parts/top-menu'); }
/** * Sets the subdomain prepending it to the base host * * @param string|null $subdomain host to be treated as subdomain, or NULL if need * to drop the subdomain * * @return SiteUrl itself */ function setSubdomain($subdomain = null) { Assert::isScalarOrNull($subdomain); $host = $subdomain ? $subdomain . '.' . $this->baseHost : $this->baseHost; $this->setHost($host); return $this; }
/** * @param string $content texutal data to be passed to response */ function __construct($content = null) { Assert::isScalarOrNull($content); $this->content = $content; }
/** * 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)); }
/** * @return HttpUrl itself */ function setCredentials($user, $password) { Assert::isScalarOrNull($user); Assert::isScalarOrNull($password); $this->user = $user; $this->pass = $password; return $this; }
/** * @param mixed $expression value expression to be selected * @param string $alias alias for value expression */ function __construct($expression, $alias = null) { Assert::isScalarOrNull($alias); $this->expression = $expression; $this->alias = $alias; }
function setDefaultValue($value) { Assert::isScalarOrNull($value); return parent::setDefaultValue($value); }