_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q250300 | Table.addUnique | validation | public function addUnique(string ...$name): self
{
$key = new Index(...$name);
$key->setUnique();
$this->keys[$key->name] = $key;
return $this;
} | php | {
"resource": ""
} |
q250301 | Table.setPrimaryKey | validation | public function setPrimaryKey(string ...$key): self
{
$this->primaryKey = new PrimaryKey($this, ...$key);
return $this;
} | php | {
"resource": ""
} |
q250302 | Table.getTableData | validation | private function getTableData($table): self
{
if ($table instanceof Table) {
return $table;
} elseif (is_subclass_of($table, Mapper::class)) {
/* @var $mapper Mapper */
$mapper = $this->container->getByType($table);
return $mapper->getStructure();
} else {
throw new InvalidArgumentException;
}
... | php | {
"resource": ""
} |
q250303 | Table.getTableSchema | validation | private function getTableSchema(): ?Row
{
return $this->connection->query("
SELECT
[tab.ENGINE],
[col.COLLATION_NAME],
[col.CHARACTER_SET_NAME]
FROM [information_schema.TABLES] tab
JOIN [information_schema.COLLATION_CHARACTER_SET_APPLICABILITY] col ON [tab.TABLE_COLLATION] = [col.COLLATION_NAME... | php | {
"resource": ""
} |
q250304 | Table.getKeys | validation | private function getKeys(): array
{
/* @var $result Key[] */
$result = [];
$rows = $this->connection->query("
SELECT
[INDEX_NAME],
[COLUMN_NAME],
[INDEX_TYPE],
[NON_UNIQUE],
[SEQ_IN_INDEX]
FROM [information_schema.STATISTICS]
WHERE [TABLE_SCHEMA] = %s
AND [TABLE_NAME] = %s
... | php | {
"resource": ""
} |
q250305 | DefaultListenerAggregate.attachShared | validation | public function attachShared(SharedEventManagerInterface $events)
{
$events->attach('Zend\Mvc\Application', MvcEvent::EVENT_BOOTSTRAP, array($this, 'onMvcBootstrapLast'), -100000);
$events->attach('Zend\Mvc\Application', MvcEvent::EVENT_RENDER, array($this, 'onRenderAddPathStacks'), -900);
... | php | {
"resource": ""
} |
q250306 | DefaultListenerAggregate.checkMVC | validation | protected function checkMVC()
{
// check ViewResolver service to match our need. {
$viewResolver = $this->sm->get('ViewResolver');
$return = true;
if ($viewResolver instanceof ViewResolver\AggregateResolver) {
if ($viewResolver->count() == 2) {
$defReso... | php | {
"resource": ""
} |
q250307 | MessageMapper.persist | validation | public function persist(MessageInterface $message)
{
if ($message->getMessageId() > 0) {
$this->update($message, null, null, new MessageHydrator);
} else {
$this->insert($message, null, new MessageHydrator);
}
return $message;
} | php | {
"resource": ""
} |
q250308 | UuidForKey.bootUuidForKey | validation | public static function bootUuidForKey()
{
static::creating(function ($model) {
$model->incrementing = false;
$model->attributes[$model->getKeyName()] = (string) Str::orderedUuid();
});
} | php | {
"resource": ""
} |
q250309 | Logger.convert_value_to_string | validation | protected function convert_value_to_string( $value ) {
if ( $this->is_resource( $value ) ) {
$type = get_resource_type( $value );
return "(Resource:$type)";
}
if ( is_object( $value ) ) {
if ( $value instanceof \Exception || $value instanceof \Throwable ) {
return '(' . get_class( $value ) . "#{... | php | {
"resource": ""
} |
q250310 | Logger.purge | validation | public function purge( $days_older_than = 60, \wpdb $wpdb ) {
$days_older_than = absint( $days_older_than );
$tn = $this->table->get_table_name( $wpdb );
$sql = "DELETE FROM {$tn} WHERE time < DATE_SUB(NOW(), INTERVAL $days_older_than DAY)";
$wpdb->query( $sql );
} | php | {
"resource": ""
} |
q250311 | Parser.parseEachPart | validation | protected static function parseEachPart(array $parts, $format)
{
$lastPartKey = count($parts) - 1;
for ($p = 0; $p <= $lastPartKey; $p++) {
$parsedPart = static::parse($parts[$p], $format);
$numNewParts = count($parsedPart);
if ($numNewParts > 1) {
... | php | {
"resource": ""
} |
q250312 | Handler.prepareException | validation | protected function prepareException(Exception $e)
{
$e = parent::prepareException($e);
if($e instanceof PermissionDoesNotExist || $e instanceof AuthorizationException) {
$e = new AuthenticationException($e->getMessage());
}
return $e;
} | php | {
"resource": ""
} |
q250313 | DynamoDbPaginator.runQuery | validation | private function runQuery(array $query, int $limit): Result
{
$query['Limit'] = $limit + 1;
$result = $this->dynamoDbClient->query($query);
$result['Items'] = array_slice($result['Items'], 0, $limit);
return $result;
} | php | {
"resource": ""
} |
q250314 | PermissionsSync.getRoutes | validation | protected function getRoutes()
{
return collect($this->routes)
->map(function ($route) {
return $this->getRouteInformation($route);
})
->reject(function ($item) {
return is_null($item);
})
->sortBy('name')
... | php | {
"resource": ""
} |
q250315 | PermissionsSync.getRouteInformation | validation | protected function getRouteInformation(Route $route)
{
return $this->filterRoute([
'name' => $route->getName(),
'isAuthorized' => $this->isAuthorized($route),
]);
} | php | {
"resource": ""
} |
q250316 | RuleCollection.add | validation | public function add($name, Rule $rule)
{
unset($this->rules[$name]);
$this->rules[$name] = $rule;
} | php | {
"resource": ""
} |
q250317 | RuleCollection.addTag | validation | public function addTag($name, array $attributes = array())
{
foreach ($this->rules as $rule) {
$rule->addTag($name, $attributes);
}
} | php | {
"resource": ""
} |
q250318 | RuleCollection.addCollection | validation | public function addCollection(RuleCollection $collection)
{
// we need to remove all rules with the same names first because just replacing them
// would not place the new rule at the end of the merged array
foreach ($collection->all() as $name => $rule) {
unset($this->rules[$nam... | php | {
"resource": ""
} |
q250319 | RequestParser.parseContextPrefix | validation | private static function parseContextPrefix(Request &$request, $serverVars = array())
{
// Since apache 2.3.13 we have now an additional index which provides the context
if (isset($serverVars['CONTEXT_PREFIX']) && $serverVars['CONTEXT_PREFIX'] != '') {
$request->setContextPrefix( $serverV... | php | {
"resource": ""
} |
q250320 | RequestParser.parseUri | validation | private static function parseUri(Request &$request,
$uri, $defaultController, $defaultAction)
{
// All beyond the context prefix is our application request uri
$contextUri = $uri;
if (null != $request->getContextPrefix() && '/' != $request->getContextPrefix()) {
$contextUri = ... | php | {
"resource": ""
} |
q250321 | RequestParser.parseElement | validation | private static function parseElement(Request &$req,
$serverVars, $elementName, $paramName)
{
if (isset($serverVars[$elementName])) {
$req->setParam( $paramName, $serverVars[$elementName] );
}
} | php | {
"resource": ""
} |
q250322 | RequestParser.parseParameters | validation | private static function parseParameters(Request &$req, $serverVars)
{
self::parseElement($req, $serverVars, 'HTTP_ACCEPT', 'Accept');
self::parseElement($req, $serverVars, 'HTTP_ACCEPT_LANGUAGE', 'Accept-Language');
self::parseElement($req, $serverVars, 'HTTP_ACCEPT_ENCODING', 'Accept-Encodi... | php | {
"resource": ""
} |
q250323 | RequestParser.parseRemoteHost | validation | private static function parseRemoteHost(Request &$request, $serverVars = array())
{
if (isset($serverVars['REMOTE_ADDR'])) {
$request->remoteHost = $serverVars['REMOTE_ADDR'];
}
if (isset($serverVars['HTTP_X_FORWARDED_FOR'])) {
$request->remoteHost = $serverVars['HTTP... | php | {
"resource": ""
} |
q250324 | RequestParser.parseGetPostSessionCookie | validation | private static function parseGetPostSessionCookie(Request &$request)
{
foreach ($_GET as $name => $value) {
$request->params[$name] = $value;
}
foreach ($_POST as $name => $value) {
$request->params[$name] = $value;
}
foreach ($_COOKIE as $name => $val... | php | {
"resource": ""
} |
q250325 | ContainerAbstract.add | validation | public function add(string $id, $concrete = null, bool $shared = null): DefinitionInterface
{
// handle special case when the $id is the interface name and the $concrete the real class.
// TODO : bout de code à virer si on recherche directement avec le getAlias du definition
if (is_string($c... | php | {
"resource": ""
} |
q250326 | ContainerAbstract.getAlias | validation | public function getAlias(string $abstract): string
{
if (! isset($this->aliases[$abstract])) {
return $abstract;
}
if ($this->aliases[$abstract] === $abstract) {
throw new ContainerException("[{$abstract}] is aliased to itself.");
}
return $this->getA... | php | {
"resource": ""
} |
q250327 | Aggregate.getName | validation | public function getName()
{
if (0 === count($this->queue)) {
return false;
}
/** @var $detector ResolverInterface */
foreach ($this->queue as $detector) {
$name = $detector->getName();
if (empty($name) && $name !== '0') {
// No resource found; try next resolver
continue;
}
... | php | {
"resource": ""
} |
q250328 | Aggregate.attach | validation | public function attach(ResolverInterface $detector, $priority = 1)
{
$this->queue->insert($detector, $priority);
return $this;
} | php | {
"resource": ""
} |
q250329 | MemoryStream.slurp | validation | public function slurp(): string
{
$str = "";
while ($this->ready()) {
$str .= $this->read($this->count());
}
return $str;
} | php | {
"resource": ""
} |
q250330 | Form.viewBody | validation | public function viewBody() {
// Get sticky values
$sticky_values = hypePrototyper()->prototype->getStickyValues($this->action);
hypePrototyper()->prototype->clearStickyValues($this->action);
// Get validation errors and messages
$validation_status = hypePrototyper()->prototype->getValidationStatus($this->ac... | php | {
"resource": ""
} |
q250331 | Form.isMultipart | validation | function isMultipart() {
foreach ($this->fields as $field) {
if (!$field instanceof Field) {
continue;
}
if ($field->getType() == 'file' || $field->getValueType() == 'file' || $field->getDataType()) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q250332 | Menu.normalizeOptions | validation | protected function normalizeOptions(array $options = [])
{
$options = parent::normalizeOptions($options);
if (isset($options['subLiClassLevel0']) && $options['subLiClassLevel0'] !== null) {
$options['subLiClassLevel0'] = (string) $options['subLiClassLevel0'];
} else {
... | php | {
"resource": ""
} |
q250333 | Menu.putPagePartial | validation | public function putPagePartial($page, $partial)
{
if (null === $partial || is_string($partial) || is_array($partial)) {
$this->pagePartials[$page] = $partial;
}
return $this;
} | php | {
"resource": ""
} |
q250334 | Menu.getPagePartial | validation | public function getPagePartial($page)
{
if (isset($this->pagePartials[$page])) {
return $this->pagePartials[$page];
}
return null;
} | php | {
"resource": ""
} |
q250335 | ActionController.handle | validation | public function handle() {
try {
if ($this->validate()) {
$result = $this->update();
}
} catch (\hypeJunction\Exceptions\ActionValidationException $ex) {
register_error(elgg_echo('prototyper:validate:error'));
forward(REFERER);
} catch (\IOException $ex) {
register_error(elgg_echo('prototyper:... | php | {
"resource": ""
} |
q250336 | ActionController.validate | validation | public function validate() {
hypePrototyper()->prototype->saveStickyValues($this->action);
$valid = true;
foreach ($this->fields as $field) {
if (!$field instanceof Field) {
continue;
}
$validation = $field->validate($this->entity);
hypePrototyper()->prototype->setFieldValidationStatus($this->... | php | {
"resource": ""
} |
q250337 | ActionController.update | validation | public function update() {
hypePrototyper()->prototype->saveStickyValues($this->action);
// first handle attributes
foreach ($this->fields as $field) {
if ($field->getDataType() == 'attribute') {
$this->entity = $field->handle($this->entity);
}
}
if (!$this->entity->save()) {
return false;
}... | php | {
"resource": ""
} |
q250338 | Module.onLoadModulesPostAddServices | validation | public function onLoadModulesPostAddServices(ModuleEvent $e)
{
/** @var $moduleManager \Zend\ModuleManager\ModuleManager */
$moduleManager = $e->getTarget();
// $sharedEvents = $moduleManager->getEventManager()->getSharedManager();
/** @var $sm ServiceManager */
$sm = $... | php | {
"resource": ""
} |
q250339 | Module.initThemeManager | validation | public function initThemeManager(ModuleEvent $e)
{
/** @var $moduleManager \Zend\ModuleManager\ModuleManager */
$moduleManager = $e->getTarget();
// $sharedEvents = $moduleManager->getEventManager()->getSharedManager();
$sm = $moduleManager->getEvent()->getParam('ServiceManager');
... | php | {
"resource": ""
} |
q250340 | ServerSocket.serve | validation | public function serve(ServiceCallback $callback)
{
$this->bind();
$this->listen();
$runOn = true;
while ($runOn) {
$clientHandle = @socket_accept($this->handle);
if (! is_resource($clientHandle)) {
$code ... | php | {
"resource": ""
} |
q250341 | ServerSocket.bind | validation | private function bind()
{
if (! @socket_bind($this->handle, $this->endpoint->getAddress(), $this->endpoint->getPort())) {
$code = socket_last_error($this->handle);
throw new SocketException(socket_strerror($code), array(), $code);
}
} | php | {
"resource": ""
} |
q250342 | ServerSocket.listen | validation | private function listen()
{
if (! @socket_listen($this->handle, 5)) {
$code = socket_last_error($this->handle);
throw new SocketException(socket_strerror($code), array(), $code);
}
} | php | {
"resource": ""
} |
q250343 | LogQuery.build_sql | validation | protected function build_sql() {
$builder = new Builder();
$select = $this->parse_select();
$from = new From( $this->table->get_table_name( $GLOBALS['wpdb'] ), 'q' );
$where = new Where( 1, true, 1 );
if ( ( $message = $this->parse_message() ) !== null ) {
$where->qAnd( $message );
}
if ( ( $lev... | php | {
"resource": ""
} |
q250344 | LogQuery.parse_message | validation | protected function parse_message() {
if ( empty( $this->args['message'] ) ) {
return null;
}
$like = esc_sql( $this->args['message'] );
return new Where( 'message', 'LIKE', "%{$like}%" );
} | php | {
"resource": ""
} |
q250345 | LogQuery.parse_user | validation | protected function parse_user() {
if ( ! empty( $this->args['user'] ) ) {
$this->args['user__in'] = array( $this->args['user'] );
}
return $this->parse_in_or_not_in_query( 'user', $this->args['user__in'], $this->args['user__not_in'] );
} | php | {
"resource": ""
} |
q250346 | LogQuery.parse_time | validation | protected function parse_time() {
if ( ! empty( $this->args['time'] ) ) {
$date_query = new \WP_Date_Query( $this->args['time'], 'q.time' );
return new Where_Date( $date_query );
} else {
return null;
}
} | php | {
"resource": ""
} |
q250347 | Locator.getPreparedThemeObject | validation | public function getPreparedThemeObject()
{
$name = $this->attainThemeName();
$path = $this->attainPathName();
$return = false;
if ($name && $path) {
// we are attained theme
$return = $this->getThemeObject();
$return->setName($name);
... | php | {
"resource": ""
} |
q250348 | Locator.getMvcLayout | validation | public function getMvcLayout(MvcEvent $e)
{
try {
$resolver = $this->getResolverObject('mvclayout_resolver_adapter', array('event_mvc' => $e));
} catch (\Exception $e) {
throw $e;
}
$layout = $resolver->getName();
if (empty($layout) && ! ($layout === ... | php | {
"resource": ""
} |
q250349 | Locator.attainThemeName | validation | protected function attainThemeName()
{
$themeName = $this->getResolverObject('resolver_adapter_service')
->getName();
return (empty($themeName) && ! ($themeName === '0')) ? false : $themeName;
} | php | {
"resource": ""
} |
q250350 | Locator.getResolverObject | validation | public function getResolverObject($state = null, array $options = array())
{
if ($state == null && isset($this->resolverObject['last_resolver'])) {
// latest invoked resolver
return $this->resolverObject['last_resolver'];
}
if ($state != 'resolver_adapter_ser... | php | {
"resource": ""
} |
q250351 | Locator.attainPathName | validation | protected function attainPathName()
{
$path = false;
// get default themes path by config {
$config = $this->getConfig();
if (isset($config['theme_locator']['themes_default_path'])) {
$path = $config['theme_locator']['themes_default_path'];
}
// ... }
... | php | {
"resource": ""
} |
q250352 | Locator.getConfig | validation | protected function getConfig()
{
// get default manager config used by default theme locator
$config = $this->getServiceLocator()->get('config');
if (isset($config['yima-theme']) && is_array($config['yima-theme'])) {
$config = $config['yima-theme'];
} else {
$... | php | {
"resource": ""
} |
q250353 | Visit.setVisitTime | validation | public function setVisitTime($visitTime)
{
if ($visitTime instanceof \DateTime) {
$this->visitTime = $visitTime;
} else {
$this->visitTime = new \DateTime($visitTime);
}
return $this;
} | php | {
"resource": ""
} |
q250354 | Application.setUp | validation | public function setUp()
{
$this->controllers = array();
$this->views = array();
$this->viewControls = array();
$this->setDefaults();
$this->init();
$this->setLogger(new NullLogger());
return $this;
} | php | {
"resource": ""
} |
q250355 | Application.init | validation | public function init()
{
$this->registerController(\Nkey\Caribu\Mvc\Controller\ErrorController::class);
$this->registerView(\Nkey\Caribu\Mvc\View\DefaultView::class);
} | php | {
"resource": ""
} |
q250356 | Application.setDefaults | validation | public function setDefaults($defaultController = 'Index', $defaultAction = 'index')
{
$this->defaultController = $defaultController;
$this->defaultAction = $defaultAction;
return $this;
} | php | {
"resource": ""
} |
q250357 | Application.registerView | validation | public function registerView($view, $order = null, $applicationName = 'default')
{
if (! class_exists($view)) {
throw new ViewException("No such view class {view} found", array(
'view' => $view
));
}
$v = new $view();
if (! $v instance... | php | {
"resource": ""
} |
q250358 | Application.unregisterView | validation | public function unregisterView($view, $order, $applicationName = 'default')
{
if (isset($this->views[$applicationName][$order][$view])) {
unset($this->views[$applicationName][$order][$view]);
}
return $this;
} | php | {
"resource": ""
} |
q250359 | Application.getViewBestMatch | validation | private function getViewBestMatch(Request $request, $applicationName)
{
$best = null;
if (count($this->views[$applicationName]) > 0) {
foreach ($this->views[$applicationName] as $orderLevel => $views) {
foreach ($views as $view) {
assert($view... | php | {
"resource": ""
} |
q250360 | Application.registerController | validation | public function registerController($controller, $applicationName = 'default')
{
if ( !$controller instanceof \Nkey\Caribu\Mvc\Controller\AbstractController ) {
if (! class_exists($controller)) {
throw new ControllerException("No such controller class {controller} found", array(
... | php | {
"resource": ""
} |
q250361 | Application.registerRouter | validation | public function registerRouter(AbstractRouter $router)
{
$this->router = $router;
$this->router->setApplication($this);
return $this;
} | php | {
"resource": ""
} |
q250362 | HttpClientTrait.retrieveHeaders | validation | public function retrieveHeaders(): array
{
$this->setHeader('Connection', 'close');
$this->setHeader('Accept', '');
$this->setHeader('Accept-Language', '');
$this->setHeader('User-Agent', '');
$savedProto = $this->protocol;
$this->protocol = 'HTTP/1.0';
... | php | {
"resource": ""
} |
q250363 | HttpClientTrait.prepareRequest | validation | private function prepareRequest($requestType): MemoryStream
{
$ms = new MemoryStream();
// First send the request type
$ms->interpolate("{rqtype} {path}{query} {proto}\r\n", array(
'rqtype' => $requestType,
'path' => $this->path,
'proto' => $this-... | php | {
"resource": ""
} |
q250364 | HttpClientTrait.retrieveAndParseResponse | validation | private function retrieveAndParseResponse($requestType)
{
$this->payload = new MemoryStream();
$this->headers = array();
$delimiterFound = false;
$tmp = "";
$numBytes = 1;
$start = time();
while (true) {
if (! $this->checkConnecti... | php | {
"resource": ""
} |
q250365 | HttpClientTrait.appendPayloadToRequest | validation | private function appendPayloadToRequest(MemoryStream $ms): MemoryStream
{
$this->payload->reset();
while ($this->payload->ready()) {
$ms->write($this->payload->read(1024));
}
$ms->reset();
return $ms;
} | php | {
"resource": ""
} |
q250366 | HttpClientTrait.handleHeader | validation | private function handleHeader(&$delimiterFound, &$numBytes, &$tmp)
{
if ($tmp == "\r\n") {
$numBytes = $this->adjustNumbytes($numBytes);
$delimiterFound = true;
$tmp = "";
return;
}
if (substr($tmp, - 2, 2) == "\r\n") {
$th... | php | {
"resource": ""
} |
q250367 | HttpClientTrait.requestImpl | validation | private function requestImpl(string $requestType)
{
if ($requestType == 'HEAD') {
$this->setTimeout(1); // Don't wait too long on simple head
}
$ms = $this->prepareRequest($requestType);
$ms = $this->appendPayloadToRequest($ms);
if (! $t... | php | {
"resource": ""
} |
q250368 | HttpClientTrait.checkConnection | validation | private function checkConnection($start): bool
{
if (! $this->ready()) {
if (time() - $start > $this->timeout) {
$this->disconnect();
throw new HttpException("Connection timed out!");
}
return false;
}
... | php | {
"resource": ""
} |
q250369 | HttpClientTrait.checkContentLengthExceeded | validation | private function checkContentLengthExceeded(): bool
{
if (isset($this->headers['Content-Length'])) {
if ($this->payload->count() >= $this->headers['Content-Length']) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q250370 | StandardOutputStream.setInterceptor | validation | public function setInterceptor(StreamInterceptor $interceptor)
{
$this->interceptor = $interceptor;
stream_filter_append($this->stdout, $interceptor->getFilterName());
} | php | {
"resource": ""
} |
q250371 | SymfonyAction.create | validation | public static function create($name, SymfonyRoute $route, $method, $description = '')
{
return new static($name, $route, $method, $description);
} | php | {
"resource": ""
} |
q250372 | YamlFileLoader.load | validation | public function load($file, $type = null)
{
$path = $this->locator->locate($file);
if (!stream_is_local($path)) {
throw new \InvalidArgumentException(sprintf('This is not a local file "%s".', $path));
}
if (!file_exists($path)) {
throw new \InvalidArgumentEx... | php | {
"resource": ""
} |
q250373 | YamlFileLoader.validate | validation | protected function validate($config, $name, $path)
{
if (!is_array($config)) {
throw new \InvalidArgumentException(sprintf('The definition of "%s" in "%s" must be a YAML array.', $name, $path));
}
if ($extraKeys = array_diff(array_keys($config), self::$availableKeys)) {
... | php | {
"resource": ""
} |
q250374 | AbstractRouter.route | validation | public function route(string $name, Request $request)
{
$parts = \explode('/', $request->getOrigin());
$found = false;
for($i = 0; $i < count($parts); $i++) {
if($parts[$i] === $name && isset($parts[$i+1])) {
$action = $parts[$i+1];
if(strpos($action, "?")) {
$action = strstr($action, "?", true);... | php | {
"resource": ""
} |
q250375 | Topic.setLastPost | validation | public function setLastPost($lastPost)
{
if ($lastPost == 0) {
$this->_lastPost = "";
} elseif ($lastPost !== "" and $lastPost !== "NULL" and $lastPost !== null) {
if ($lastPost instanceof DateTime) {
$this->_lastPost = $lastPost;
} else {
... | php | {
"resource": ""
} |
q250376 | UrlParser.parseUrl | validation | public static function parseUrl($url): Url
{
$parts = parse_url($url);
if (false === $parts || false === Arrays::hasElement($parts, 'host') || false === Arrays::hasElement($parts, 'scheme')) {
throw new InvalidUrlException('The URL {url} does not contain necessary parts', array(... | php | {
"resource": ""
} |
q250377 | Rule.clearTag | validation | public function clearTag($name)
{
if (isset($this->tags[$name])) {
unset($this->tags[$name]);
}
return $this;
} | php | {
"resource": ""
} |
q250378 | ReflectionResolver.call | validation | public function call(callable $callable, array $args = [])
{
$args = $this->resolveArguments($args);
$reflection = $this->reflectCallable($callable);
return call_user_func_array(
$callable,
$this->getParameters($reflection, $args)
);
} | php | {
"resource": ""
} |
q250379 | Formatter.formatCamelCaseWithAcronyms | validation | public static function formatCamelCaseWithAcronyms(array $parts)
{
$camelCase = array_map(function($p) {
return static::ucfirstAndLowerNonAcronym($p);
}, $parts);
if (static::isAcronym($camelCase[0])) {
return implode('', $camelCase);
}
return lcfirs... | php | {
"resource": ""
} |
q250380 | Request.parse | validation | public static function parse($uri, $serverVars = array(), $defaultController = 'Index', $defaultAction = 'index')
{
$req = new self($defaultController, $defaultAction);
$req->origin = $uri;
self::parseRemoteHost($req, $serverVars);
self::parseGetPostSessionCookie($r... | php | {
"resource": ""
} |
q250381 | Request.parseFromServerRequest | validation | public static function parseFromServerRequest($serverVars, $defaultController = 'Index', $defaultAction = 'index')
{
if (! isset($serverVars['REQUEST_URI'])) {
throw new InvalidUrlException("No such uri provided");
}
return self::parse($serverVars['REQUEST_URI'], $serverVars, $de... | php | {
"resource": ""
} |
q250382 | Request.getParam | validation | public function getParam($name, $typeOf = 'string')
{
$result = $this->hasParam($name) ? $this->params[$name] : null;
switch ($typeOf) {
case 'bool':
case 'boolean':
$result = function_exists('boolval') ? boolval($result) : (bool) $result;
... | php | {
"resource": ""
} |
q250383 | ParamsTrait.getParams | validation | public function getParams()
{
// initialize the array for the params
$params = array();
// prepare the params, e. g. explode them into an array
if ($paramsAvailable = reset($this->params)) {
foreach (array_keys($paramsAvailable) as $paramKey) {
$params[$... | php | {
"resource": ""
} |
q250384 | ParamsTrait.getParam | validation | public function getParam($name, $defaultValue = null)
{
// load the params
$params = reset($this->params);
// query whether or not, the param with the passed name is set
if (is_array($params) && isset($params[$name])) {
// load the value from the array
$valu... | php | {
"resource": ""
} |
q250385 | RandomString.generate | validation | public static function generate($length = 8, $allowed = RandomString::ASCII, $repeatable = true): string
{
$allowedChars = array();
$currentLocale = setlocale(LC_ALL, "0");
if ($allowed == RandomString::ASCII) {
setlocale(LC_ALL, "C");
}
for ($i ... | php | {
"resource": ""
} |
q250386 | RandomString.resetLocaleTo | validation | private static function resetLocaleTo($localeSaved)
{
$localeData = explode(';', $localeSaved);
foreach ($localeData as $identifier) {
if (! strchr($identifier, '=')) {
continue;
}
$type = $value = null;
sscanf($identifier, "%s... | php | {
"resource": ""
} |
q250387 | Session.get | validation | public function get($key)
{
if (! isset($this->sessionContainer[$key])) {
return null;
}
return $this->sessionContainer[$key];
} | php | {
"resource": ""
} |
q250388 | Socket.open | validation | private function open()
{
$this->handle = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if (! is_resource($this->handle)) {
$code = socket_last_error();
throw new SocketException(socket_strerror($code), array(), $code);
}
} | php | {
"resource": ""
} |
q250389 | UserNotificationController.markAsRead | validation | public function markAsRead($uid)
{
if(!$object = $this->model->find($uid)) {
abort(404);
}
$this->authorize('update', $object);
$object->markAsRead();
\Cache::tags('response')->flush();
return $this->successJsonResponse();
} | php | {
"resource": ""
} |
q250390 | UserNotificationController.markAsUnread | validation | public function markAsUnread($uid)
{
if(!$object = $this->model->find($uid)) {
abort(404);
}
$this->authorize('update', $object);
if (!is_null($object->read_at)) {
$object->forceFill(['read_at' => null])->save();
}
\Cache::tags('response')->... | php | {
"resource": ""
} |
q250391 | UserMapper.fetchAll | validation | public function fetchAll($columns = null, \Closure $Closure = null)
{
$select = $this->getSelect();
if ($columns) {
$select->columns($columns);
}
if ($Closure) {
$Closure($select);
}
return $this->select($select);
} | php | {
"resource": ""
} |
q250392 | UserMapper.getSelectOptions | validation | public function getSelectOptions()
{
$filter = new UnderscoreToCamelCase();
$funcName = "get" . ucfirst($filter->filter($this->getUserColumn()));
$resultSet = $this->fetchAll(array('user_id', $this->getUserColumn()), function (Select $select) {
$select->where->notEqualTo('user_... | php | {
"resource": ""
} |
q250393 | Profile.view | validation | public function view($vars = array()) {
$output = '';
$vars['entity'] = $this->entity;
foreach ($this->fields as $field) {
if (!$field instanceof Field) {
continue;
}
if ($field->getOutputView() === false) {
continue;
}
if ($field->getType() == 'hidden' || $field->getValueType() == 'hidd... | php | {
"resource": ""
} |
q250394 | Url.getUrlString | validation | public function getUrlString(): string
{
$query = "";
if (strlen($this->queryString) > 0) {
$query = sprintf("?%s", $this->queryString);
}
if (($this->scheme == 'http' && $this->getPort() == 80) || ($this->scheme == 'ftp' && $this->getPort() == 21) || ($this->sch... | php | {
"resource": ""
} |
q250395 | AbstractController.parseParameters | validation | private function parseParameters(\ReflectionMethod $action)
{
$params = $action->getParameters();
if (count($params) < 1) {
return false;
}
$param = $params[0];
assert($param instanceof \ReflectionParameter);
if (! ($class = $param->getClass()) ||... | php | {
"resource": ""
} |
q250396 | AbstractController.parseAnnotations | validation | private function parseAnnotations(\ReflectionMethod $action)
{
if ($action->isConstructor() || $action->isDestructor() || $action->isStatic() || $action->isFinal()) {
return;
}
$rfMethod = new \ReflectionMethod($this, $action->name);
$anno = $rfMethod->getDocComm... | php | {
"resource": ""
} |
q250397 | AbstractController.getControllerSettings | validation | final public function getControllerSettings()
{
$rf = new \ReflectionClass($this);
$this->response = new Response();
$this->controllerClass = $rf->getShortName();
$this->controllerName = ucfirst(str_replace('Controller', '', $this->controllerClass));
$this->response-... | php | {
"resource": ""
} |
q250398 | AbstractController.call | validation | final public function call($action, Request $request, View $view)
{
$this->request = $request;
ob_start();
$rf = new \ReflectionMethod($this, $action);
$anno = $rf->getDocComment();
$matches = array();
if (preg_match('#@responseType ([\w\/]+... | php | {
"resource": ""
} |
q250399 | AbstractController.addControls | validation | protected function addControls(Response &$response, Request $request, View $view)
{
$matches = array();
while (preg_match("/\{(\w+)=(\w+)\}/", $response->getBody(), $matches)) {
$controlIdentifier = $matches[1];
$controlName = $matches[2];
$currentBody = ... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.