_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q235100 | ButtonFactory.parseButton | train | protected static function parseButton(ButtonInterface $button, array $args) {
$button->setActive(ArrayHelper::get($args, "active", false));
$button->setBlock(ArrayHelper::get($args, "block", false));
$button->setContent(ArrayHelper::get($args, "content"));
$button->setDisabled(ArrayHelp... | php | {
"resource": ""
} |
q235101 | AbstractWikiController.getSyntaxHighlighterConfig | train | protected function getSyntaxHighlighterConfig() {
$provider = $this->get(SyntaxHighlighterStringsProvider::SERVICE_NAME);
$config = new SyntaxHighlighterConfig();
$config->setStrings($provider->getSyntaxHighlighterStrings());
return $config;
} | php | {
"resource": ""
} |
q235102 | Toolbar_Theme_Switcher.setup_theme | train | public static function setup_theme() {
global $pagenow;
if ( ( is_admin() && 'themes.php' == $pagenow ) || ! self::can_switch_themes() ) {
return;
}
self::check_reset();
self::load_cookie();
if ( empty( self::$theme ) ) {
return;
}
add_filter( 'pre_option_template', array( self::$theme, 'get_... | php | {
"resource": ""
} |
q235103 | Toolbar_Theme_Switcher.check_reset | train | public static function check_reset() {
if ( ! empty( filter_input( INPUT_GET, 'tts_reset' ) ) ) {
setcookie( self::get_cookie_name(), '', 1 );
nocache_headers();
wp_safe_redirect( home_url() );
die;
}
} | php | {
"resource": ""
} |
q235104 | Toolbar_Theme_Switcher.load_cookie | train | public static function load_cookie() {
$theme_name = filter_input( INPUT_COOKIE, self::get_cookie_name() );
if ( ! $theme_name ) {
return;
}
$theme = wp_get_theme( $theme_name );
if (
$theme->exists()
&& $theme->get( 'Name' ) !== get_option( 'current_theme' )
&& $theme->is_allowed()
) {
... | php | {
"resource": ""
} |
q235105 | Toolbar_Theme_Switcher.get_allowed_themes | train | public static function get_allowed_themes() {
static $themes;
if ( isset( $themes ) ) {
return $themes;
}
$wp_themes = wp_get_themes( array( 'allowed' => true ) );
/** @var WP_Theme $theme */
foreach ( $wp_themes as $theme ) {
// Make keys names (rather than slugs) for backwards compat.
$theme... | php | {
"resource": ""
} |
q235106 | Toolbar_Theme_Switcher.init | train | public static function init() {
if ( self::can_switch_themes() ) {
add_action( 'admin_bar_menu', array( __CLASS__, 'admin_bar_menu' ), 90 );
add_action( 'wp_ajax_tts_set_theme', array( __CLASS__, 'set_theme' ) );
}
load_plugin_textdomain( 'toolbar-theme-switcher', false, dirname( dirname( plugin_basename(... | php | {
"resource": ""
} |
q235107 | Toolbar_Theme_Switcher.admin_bar_menu | train | public static function admin_bar_menu( $wp_admin_bar ) {
$themes = self::get_allowed_themes();
$current = empty( self::$theme ) ? wp_get_theme() : self::$theme;
unset( $themes[ $current->get( 'Name' ) ] );
uksort( $themes, array( __CLASS__, 'sort_core_themes' ) );
$title = apply_filters( 'tts_root_title', s... | php | {
"resource": ""
} |
q235108 | Toolbar_Theme_Switcher.sort_core_themes | train | public static function sort_core_themes( $theme_a, $theme_b ) {
static $twenties = array(
'Twenty Ten',
'Twenty Eleven',
'Twenty Twelve',
'Twenty Thirteen',
'Twenty Fourteen',
'Twenty Fifteen',
'Twenty Sixteen',
'Twenty Seventeen',
'Twenty Eighteen',
'Twenty Nineteen',
'Twenty Twenty... | php | {
"resource": ""
} |
q235109 | Toolbar_Theme_Switcher.set_theme | train | public static function set_theme() {
$stylesheet = filter_input( INPUT_GET, 'theme' );
$theme = wp_get_theme( $stylesheet );
if ( $theme->exists() && $theme->is_allowed() ) {
setcookie( self::get_cookie_name(), $theme->get_stylesheet(), strtotime( '+1 year' ), COOKIEPATH );
}
wp_safe_redirect( wp_g... | php | {
"resource": ""
} |
q235110 | Toolbar_Theme_Switcher.get_theme_field | train | public static function get_theme_field( $field_name, $default = false ) {
if ( ! empty( self::$theme ) ) {
return self::$theme->get( $field_name );
}
return $default;
} | php | {
"resource": ""
} |
q235111 | AuthorizationServer.getGrant | train | public function getGrant(string $grantType): GrantInterface
{
if ($this->hasGrant($grantType)) {
return $this->grants[$grantType];
}
// If we reach here... then no grant was found. Not good!
throw OAuth2Exception::unsupportedGrantType(sprintf(
'Grant type "%s... | php | {
"resource": ""
} |
q235112 | AuthorizationServer.getResponseType | train | public function getResponseType(string $responseType): GrantInterface
{
if ($this->hasResponseType($responseType)) {
return $this->responseTypes[$responseType];
}
// If we reach here... then no grant was found. Not good!
throw OAuth2Exception::unsupportedResponseType(spr... | php | {
"resource": ""
} |
q235113 | AuthorizationServer.createResponseFromOAuthException | train | private function createResponseFromOAuthException(OAuth2Exception $exception): ResponseInterface
{
$payload = [
'error' => $exception->getCode(),
'error_description' => $exception->getMessage(),
];
return new Response\JsonResponse($payload, 400);
} | php | {
"resource": ""
} |
q235114 | AuthorizationServer.extractClientCredentials | train | private function extractClientCredentials(ServerRequestInterface $request): array
{
// We first try to get the Authorization header, as this is the recommended way according to the spec
if ($request->hasHeader('Authorization')) {
// The value is "Basic xxx", we are interested in the last... | php | {
"resource": ""
} |
q235115 | Command.getDigitalOcean | train | public function getDigitalOcean($file = self::DEFAULT_CREDENTIALS_FILE)
{
if (!file_exists($file)) {
throw new \RuntimeException(sprintf('Impossible to get credentials informations in %s', $file));
}
$credentials = Yaml::parse($file);
return new DigitalOcean(new Credent... | php | {
"resource": ""
} |
q235116 | SourceFinderHelper.getLeadingDir | train | private static function getLeadingDir(string $pattern): string
{
$dir = $pattern;
$pos = strpos($dir, '*');
if ($pos!==false) $dir = substr($dir, 0, $pos);
$pos = strpos($dir, '?');
if ($pos!==false) $dir = substr($dir, 0, $pos);
$pos = strrpos($dir, '/');
if ($pos!==false)
{
... | php | {
"resource": ""
} |
q235117 | SourceFinderHelper.findSources | train | public function findSources(string $sources): array
{
$patterns = $this->sourcesToPatterns($sources);
$sources = [];
foreach ($patterns as $pattern)
{
$tmp = $this->findSourcesInPattern($pattern);
$sources = array_merge($sources, $tmp);
}
$sources = array_unique($sources);
... | php | {
"resource": ""
} |
q235118 | SourceFinderHelper.findSourcesInPattern | train | private function findSourcesInPattern(string $pattern): array
{
$sources = [];
$directory = new RecursiveDirectoryIterator(self::getLeadingDir($pattern));
$directory->setFlags(RecursiveDirectoryIterator::FOLLOW_SYMLINKS);
$files = new RecursiveIteratorIterator($directory);
foreach ($files as $ful... | php | {
"resource": ""
} |
q235119 | SourceFinderHelper.readPatterns | train | private function readPatterns(string $filename): array
{
$path = $this->basedir.'/'.$filename;
$lines = explode(PHP_EOL, file_get_contents($path));
$patterns = [];
foreach ($lines as $line)
{
$line = trim($line);
if ($line<>'')
{
$patterns[] = $line;
}
}
... | php | {
"resource": ""
} |
q235120 | SourceFinderHelper.sourcesToPatterns | train | private function sourcesToPatterns(string $sources): array
{
if (substr($sources, 0, 5)=='file:')
{
$patterns = $this->readPatterns(substr($sources, 5));
}
else
{
$patterns = [$sources];
}
return $patterns;
} | php | {
"resource": ""
} |
q235121 | AbstractButtonGroupTwigExtension.bootstrapButtonGroup | train | protected function bootstrapButtonGroup($class, $role, array $buttons) {
$attributes = [];
$attributes["class"] = $class;
$attributes["role"] = $role;
$innerHTML = "\n" . implode("\n", $buttons) . "\n";
return static::coreHTMLElement("div", $innerHTML, $attributes);
} | php | {
"resource": ""
} |
q235122 | AuthorizationCode.createNewAuthorizationCode | train | public static function createNewAuthorizationCode(
int $ttl,
string $redirectUri = null,
TokenOwnerInterface $owner = null,
Client $client = null,
$scopes = null
): AuthorizationCode {
$token = static::createNew($ttl, $owner, $client, $scopes);
$token->redire... | php | {
"resource": ""
} |
q235123 | GridHelper.getCSSClassname | train | public static function getCSSClassname($size, $value, $suffix, $min = 1, $max = 12) {
if ($value < $min || $max < $value) {
return null;
}
$sizes = ["lg", "md", "sm", "xs"];
$suffixes = ["offset", "pull", "push", ""];
if (false === in_array($size, $sizes) || fal... | php | {
"resource": ""
} |
q235124 | InteractionsCache.getGuidFromRiverId | train | public function getGuidFromRiverId($river_id = 0) {
$river_id = (int) $river_id;
$guid = $this->id_cache->get($river_id);
if ($guid) {
return $guid;
}
$objects = elgg_get_entities_from_metadata([
'types' => RiverObject::TYPE,
'subtypes' => [RiverObject::SUBTYPE, 'hjstream'],
'metadata_name_valu... | php | {
"resource": ""
} |
q235125 | WikiController.getWikiViews | train | public static function getWikiViews() {
$tableContents = [];
$tableContents[] = new WikiView("Twig-extension", "CSS", "button", "Button");
$tableContents[] = new WikiView("twig-extension", "CSS", "code", "Code");
$tableContents[] = new WikiView("Twig-extension", "CSS", "grid", "Grid");... | php | {
"resource": ""
} |
q235126 | WikiController.indexAction | train | public function indexAction($category, $package, $page) {
$wikiViews = self::getWikiViews();
$wikiView = WikiView::find($wikiViews, $category, $package, $page);
if (null === $wikiView) {
// Set a default wiki view.
$wikiView = $wikiViews[0];
$this->notifyD... | php | {
"resource": ""
} |
q235127 | ButtonTwigExtension.bootstrapButtonDangerFunction | train | public function bootstrapButtonDangerFunction(array $args = []) {
return $this->bootstrapButton(ButtonFactory::parseDangerButton($args), ArrayHelper::get($args, "icon"));
} | php | {
"resource": ""
} |
q235128 | ButtonTwigExtension.bootstrapButtonDefaultFunction | train | public function bootstrapButtonDefaultFunction(array $args = []) {
return $this->bootstrapButton(ButtonFactory::parseDefaultButton($args), ArrayHelper::get($args, "icon"));
} | php | {
"resource": ""
} |
q235129 | ButtonTwigExtension.bootstrapButtonInfoFunction | train | public function bootstrapButtonInfoFunction(array $args = []) {
return $this->bootstrapButton(ButtonFactory::parseInfoButton($args), ArrayHelper::get($args, "icon"));
} | php | {
"resource": ""
} |
q235130 | ButtonTwigExtension.bootstrapButtonLinkFilter | train | public function bootstrapButtonLinkFilter($button, $href = self::DEFAULT_HREF, $target = null) {
if (1 === preg_match("/disabled=\"disabled\"/", $button)) {
$searches = [" disabled=\"disabled\"", "class=\""];
$replaces = ["", "class=\"disabled "];
$button = StringHelper::r... | php | {
"resource": ""
} |
q235131 | ButtonTwigExtension.bootstrapButtonLinkFunction | train | public function bootstrapButtonLinkFunction(array $args = []) {
return $this->bootstrapButton(ButtonFactory::parseLinkButton($args), ArrayHelper::get($args, "icon"));
} | php | {
"resource": ""
} |
q235132 | ButtonTwigExtension.bootstrapButtonPrimaryFunction | train | public function bootstrapButtonPrimaryFunction(array $args = []) {
return $this->bootstrapButton(ButtonFactory::parsePrimaryButton($args), ArrayHelper::get($args, "icon"));
} | php | {
"resource": ""
} |
q235133 | ButtonTwigExtension.bootstrapButtonSuccessFunction | train | public function bootstrapButtonSuccessFunction(array $args = []) {
return $this->bootstrapButton(ButtonFactory::parseSuccessButton($args), ArrayHelper::get($args, "icon"));
} | php | {
"resource": ""
} |
q235134 | ButtonTwigExtension.bootstrapButtonWarningFunction | train | public function bootstrapButtonWarningFunction(array $args = []) {
return $this->bootstrapButton(ButtonFactory::parseWarningButton($args), ArrayHelper::get($args, "icon"));
} | php | {
"resource": ""
} |
q235135 | AbstractTokenService.validateTokenScopes | train | protected function validateTokenScopes(array $scopes)
{
$scopes = array_map(function ($scope) {
return (string) $scope;
}, $scopes);
$registeredScopes = $this->scopeService->getAll();
$registeredScopes = array_map(function ($scope) {
return (string) $scope;
... | php | {
"resource": ""
} |
q235136 | MapperAbstract.save | train | public function save(DomainObjectInterface &$domainObject): void
{
if ($domainObject->getId() === 0) {
$this->concreteInsert($domainObject);
}
$this->concreteUpdate($domainObject);
} | php | {
"resource": ""
} |
q235137 | MysqlPdoSessionHandler.gc | train | public function gc($maxlifetime)
{
$this->pdo->queryWithParam(
'DELETE FROM session WHERE last_update < DATE_SUB(NOW(), INTERVAL :maxlifetime SECOND)',
[[':maxlifetime', $maxlifetime, \PDO::PARAM_INT]]
);
return $this->pdo->getLastOperationStatus();
} | php | {
"resource": ""
} |
q235138 | MysqlPdoSessionHandler.read | train | public function read($session_id)
{
//string casting is a fix for PHP 7
//when strict type are enable
return (string) $this->pdo->queryWithParam(
'SELECT session_data FROM session WHERE session_id = :session_id',
[[':session_id', $session_id, \PDO::PARAM_STR]]
... | php | {
"resource": ""
} |
q235139 | AlertTwigExtension.bootstrapAlertDangerFunction | train | public function bootstrapAlertDangerFunction(array $args = []) {
return $this->bootstrapAlert(ArrayHelper::get($args, "content"), ArrayHelper::get($args, "dismissible"), "alert-" . BootstrapInterface::BOOTSTRAP_DANGER);
} | php | {
"resource": ""
} |
q235140 | AlertTwigExtension.bootstrapAlertInfoFunction | train | public function bootstrapAlertInfoFunction(array $args = []) {
return $this->bootstrapAlert(ArrayHelper::get($args, "content"), ArrayHelper::get($args, "dismissible"), "alert-" . BootstrapInterface::BOOTSTRAP_INFO);
} | php | {
"resource": ""
} |
q235141 | AlertTwigExtension.bootstrapAlertLinkFunction | train | public function bootstrapAlertLinkFunction(array $args = []) {
$attributes = [];
$attributes["href"] = ArrayHelper::get($args, "href", NavigationInterface::NAVIGATION_HREF_DEFAULT);
$innerHTML = ArrayHelper::get($args, "content");
return static::coreHTMLElement("a", $innerHTML, $attr... | php | {
"resource": ""
} |
q235142 | AlertTwigExtension.bootstrapAlertSuccessFunction | train | public function bootstrapAlertSuccessFunction(array $args = []) {
return $this->bootstrapAlert(ArrayHelper::get($args, "content"), ArrayHelper::get($args, "dismissible"), "alert-" . BootstrapInterface::BOOTSTRAP_SUCCESS);
} | php | {
"resource": ""
} |
q235143 | AlertTwigExtension.bootstrapAlertWarningFunction | train | public function bootstrapAlertWarningFunction(array $args = []) {
return $this->bootstrapAlert(ArrayHelper::get($args, "content"), ArrayHelper::get($args, "dismissible"), "alert-" . BootstrapInterface::BOOTSTRAP_WARNING);
} | php | {
"resource": ""
} |
q235144 | PasswordGenerator.getTopologyGroup | train | private function getTopologyGroup(string $char): string
{
$groups = $this->chars;
if (\strpos($groups[0], $char) !== false) {
return 'u';
}
if (\strpos($groups[1], $char) !== false) {
return 'l';
}
if (\strpos($groups[2], $char) !== false) {... | php | {
"resource": ""
} |
q235145 | PasswordGenerator.getRandomChar | train | private function getRandomChar(string $interval): string
{
$size = \strlen($interval) - 1;
$int = \random_int(0, $size);
return $interval[$int];
} | php | {
"resource": ""
} |
q235146 | DataLayer.executeLog | train | public function executeLog(string $queries): int
{
// Counter for the number of rows written/logged.
$n = 0;
$this->multiQuery($queries);
do
{
$result = $this->mysqli->store_result();
if ($this->mysqli->errno) $this->mySqlError('mysqli::store_result');
if ($result)
{
... | php | {
"resource": ""
} |
q235147 | DataLayer.getRowInRowSet | train | public function getRowInRowSet(string $columnName, $value, array $rowSet): array
{
if (is_array($rowSet))
{
foreach ($rowSet as $row)
{
if ((string)$row[$columnName]==(string)$value)
{
return $row;
}
}
}
throw new RuntimeException("Value '%s' for co... | php | {
"resource": ""
} |
q235148 | DataLayer.quoteListOfInt | train | public function quoteListOfInt($list, string $delimiter, string $enclosure, string $escape): string
{
if ($list===null || $list===false || $list==='' || $list===[])
{
return 'null';
}
$ret = '';
if (is_scalar($list))
{
$list = str_getcsv($list, $delimiter, $enclosure, $escape);
... | php | {
"resource": ""
} |
q235149 | DataLayer.searchInRowSet | train | public function searchInRowSet(string $columnName, $value, array $rowSet)
{
if (is_array($rowSet))
{
foreach ($rowSet as $key => $row)
{
if ((string)$row[$columnName]===(string)$value)
{
return $key;
}
}
}
return null;
} | php | {
"resource": ""
} |
q235150 | DataLayer.sendLongData | train | protected function sendLongData(mysqli_stmt $statement, int $paramNr, ?string $data): void
{
if ($data!==null)
{
$n = strlen($data);
$p = 0;
while ($p<$n)
{
$b = $statement->send_long_data($paramNr, substr($data, $p, $this->chunkSize));
if (!$b) $this->mySqlError('mysql... | php | {
"resource": ""
} |
q235151 | DataLayer.executeTableShowFooter | train | private function executeTableShowFooter(array $columns): void
{
$separator = '+';
foreach ($columns as $column)
{
$separator .= str_repeat('-', $column['length'] + 2).'+';
}
echo $separator, "\n";
} | php | {
"resource": ""
} |
q235152 | DataLayer.executeTableShowHeader | train | private function executeTableShowHeader(array $columns): void
{
$separator = '+';
$header = '|';
foreach ($columns as $column)
{
$separator .= str_repeat('-', $column['length'] + 2).'+';
$spaces = ($column['length'] + 2) - mb_strlen((string)$column['header']);
$spacesLeft = ... | php | {
"resource": ""
} |
q235153 | NonStaticCommand.staticToStatic | train | public static function staticToStatic(string $sourceName, string $targetName): void
{
$source = file_get_contents($sourceName);
$sourceClass = basename($sourceName, '.php');
$targetClass = basename($targetName, '.php');
$source = NonStatic::nonStatic($source, $sourceClass, $targetClass);
fi... | php | {
"resource": ""
} |
q235154 | SessionMiddleware.getCookieExpirationDate | train | protected function getCookieExpirationDate()
{
if (!empty($this->config['expire_on_close'])) {
$expirationDate = 0;
} else {
$expirationDate = Carbon::now()->addMinutes(5 * 60);
}
return $expirationDate;
} | php | {
"resource": ""
} |
q235155 | ThreadManager.updateAverageNote | train | public function updateAverageNote()
{
$commentTableName = $this->em->getClassMetadata($this->commentManager->getClass())->table['name'];
$threadTableName = $this->em->getClassMetadata($this->getClass())->table['name'];
$this->em->getConnection()->beginTransaction();
$this->em->getCo... | php | {
"resource": ""
} |
q235156 | pakeTask.format_trace_flags | train | private function format_trace_flags()
{
$flags = array();
if (!$this->already_invoked)
{
$flags[] = 'first_time';
}
if (!$this->is_needed())
{
$flags[] = 'not_needed';
}
return (count($flags)) ? '('.join(', ', $flags).')' : '';
} | php | {
"resource": ""
} |
q235157 | Client.doRequest | train | protected function doRequest($method, $apiMethod, array $data = [])
{
$url = $this->config['endpoint'] . $apiMethod;
$data = $this->mergeData($this->createAuthData(), $data);
$response = $this->getGuzzleClient()->request($method, $url, ['json' => $data]);
$responseContent = \GuzzleH... | php | {
"resource": ""
} |
q235158 | Client.createAuthData | train | protected function createAuthData()
{
return [
'clientId' => $this->config['client_id'],
'apiKey' => $this->config['api_key'],
'requestTime' => time(),
'sha' => sha1($this->config['api_key'] . $this->config['client_id'] . $this->config['api_secret'])
]... | php | {
"resource": ""
} |
q235159 | Client.mergeData | train | private function mergeData(array $base, array $replacements)
{
return array_filter(array_merge($base, $replacements), function($value) {
return $value !== null;
});
} | php | {
"resource": ""
} |
q235160 | Profile.set | train | public function set($domain, $key, $value = null)
{
$this->validateDomain($domain);
if (null !== $value) {
$this->profile[$domain][$key] = $value;
} else {
$this->profile[$domain] = $key;
}
} | php | {
"resource": ""
} |
q235161 | Profile.get | train | public function get($domain, $key = null)
{
$this->validateDomain($domain);
if (null === $key) {
return new Config($this->profile[$domain]);
}
if (!isset($this->profile[$domain][$key])) {
throw new \InvalidArgumentException(sprintf(
'Unknown ... | php | {
"resource": ""
} |
q235162 | IsFieldEmpty.getFieldNames | train | protected function getFieldNames(Criterion $criterion)
{
$fieldDefinitionIdentifier = $criterion->target;
$fieldMap = $this->contentTypeHandler->getSearchableFieldMap();
$fieldNames = [];
foreach ($fieldMap as $contentTypeIdentifier => $fieldIdentifierMap) {
if (!isset($... | php | {
"resource": ""
} |
q235163 | CalendarHelper.coming_events | train | public static function coming_events($from = false)
{
$time = ($from ? strtotime($from) : mktime(0, 0, 0, date('m'), date('d'), date('Y')));
$sql = "(StartDateTime >= '".date('Y-m-d', $time)." 00:00:00')";
$events = PublicEvent::get()->where($sql);
return $events;
} | php | {
"resource": ""
} |
q235164 | CalendarHelper.coming_events_limited | train | public static function coming_events_limited($from=false, $limit=30)
{
$events = self::coming_events($from)->limit($limit);
return $events;
} | php | {
"resource": ""
} |
q235165 | CalendarHelper.add_preview_params | train | public static function add_preview_params($link,$object)
{
// Pass through if not logged in
if(!Member::currentUserID()) {
return $link;
}
$modifiedLink = '';
$request = Controller::curr()->getRequest();
if ($request && $request->getVar('CMSPreview')) {
... | php | {
"resource": ""
} |
q235166 | Command.assemble | train | protected function assemble()
{
$assembled = $this->command;
foreach ($this->arguments as $key => $value) {
if (is_int($key)
&& false === strpos((string) $key, '-')) {
$assembled .= ' '.escapeshellarg($value);
continue;
}
... | php | {
"resource": ""
} |
q235167 | PhpcrShell.createEmbeddedShell | train | public static function createEmbeddedShell(SessionInterface $session)
{
$container = new Container(self::MODE_EMBEDDED_SHELL);
$container->get('phpcr.session_manager')->setSession(new PhpcrSession($session));
$application = $container->get('application');
return new Shell($applicati... | php | {
"resource": ""
} |
q235168 | FunctionOperand.replaceColumnOperands | train | private function replaceColumnOperands($functionMap, RowInterface $row)
{
foreach ($this->arguments as $key => $value) {
if ($value instanceof ColumnOperand) {
$this->arguments[$key] = $row->getNode($value->getSelectorName())->getPropertyValue($value->getPropertyName());
... | php | {
"resource": ""
} |
q235169 | FunctionOperand.execute | train | public function execute($functionMap, $row)
{
$this->replaceColumnOperands($functionMap, $row);
$functionName = $this->getFunctionName();
if (!isset($functionMap[$functionName])) {
throw new InvalidQueryException(sprintf('Unknown function "%s", known functions are "%s"',
... | php | {
"resource": ""
} |
q235170 | FunctionOperand.validateScalarArray | train | public function validateScalarArray($array)
{
if (!is_array($array)) {
throw new \InvalidArgumentException(sprintf(
'Expected array value, got: %s',
var_export($array, true)
));
}
foreach ($array as $key => $value) {
if (fa... | php | {
"resource": ""
} |
q235171 | Breadcrumbs.register | train | public function register($name, Closure $callback)
{
$this->checkCallbackName($name);
$this->callbacks[$name] = $callback;
return $this;
} | php | {
"resource": ""
} |
q235172 | Breadcrumbs.render | train | public function render($name = null, ...$params)
{
return new HtmlString(
view($this->getView(), [
'breadcrumbs' => $this->generate($name, $params)
])->render()
);
} | php | {
"resource": ""
} |
q235173 | Breadcrumbs.generate | train | public function generate($name, ...$params)
{
return (new Builder($this->callbacks))
->call($name, $params)
->toArray();
} | php | {
"resource": ""
} |
q235174 | Breadcrumbs.checkTemplate | train | private function checkTemplate($template)
{
if ( ! is_string($template)) {
$type = gettype($template);
throw new Exceptions\InvalidTypeException(
"The default template name must be a string, $type given."
);
}
$template = strtolower(trim($... | php | {
"resource": ""
} |
q235175 | CalendarPage_Controller.calendarview | train | public function calendarview()
{
$s = CalendarConfig::subpackage_settings('pagetypes');
//Debug::dump($s);
if (isset($s['calendarpage']['calendarview']) && $s['calendarpage']['calendarview']) {
Requirements::javascript('calendar/thirdparty/fullcalendar/2.9.1/fullcalendar/lib/m... | php | {
"resource": ""
} |
q235176 | CalendarPage_Controller.detail | train | public function detail($req)
{
$event = Event::get()->byID($req->param('ID'));
if (!$event) {
return $this->httpError(404);
}
return array(
'Event' => $event,
);
} | php | {
"resource": ""
} |
q235177 | CalendarPage_Controller.Events | train | public function Events()
{
$action = $this->request->param('Action');
//Debug::dump($this->request->params());
//Normal & Registerable events
$s = CalendarConfig::subpackage_settings('pagetypes');
$indexSetting = $s['calendarpage']['index'];
if ($action == 'eventregi... | php | {
"resource": ""
} |
q235178 | CalendarPage_Controller.CurrentCalendar | train | public function CurrentCalendar()
{
$url = Convert::raw2url($this->request->param('ID'));
$cal = PublicCalendar::get()
->filter('URLSegment', $url)
->First();
return $cal;
} | php | {
"resource": ""
} |
q235179 | RepositoryHelper.hasDescriptor | train | public function hasDescriptor($descriptor, $value = null)
{
$this->loadDescriptors();
$exists = array_key_exists($descriptor, $this->descriptors);
if (false === $exists) {
return false;
}
if (null === $value) {
return true;
}
$descr... | php | {
"resource": ""
} |
q235180 | UsersRepository.getMedia | train | public function getMedia($id = 'self', $count = null, $minId = null, $maxId = null)
{
$params = ['query' => [
'count' => $count,
'min_id' => $minId,
'max_id' => $maxId,
]];
return $this->client->request(
'GET',
"users/$id/med... | php | {
"resource": ""
} |
q235181 | UsersRepository.getLikedMedia | train | public function getLikedMedia($count = null, $maxLikeId = null)
{
$params = ['query' => [
'count' => $count,
'max_like_id' => $maxLikeId
]];
return $this->client->request(
'GET',
'users/self/media/liked',
$params
);
... | php | {
"resource": ""
} |
q235182 | UsersRepository.search | train | public function search($query, $count = null)
{
$params = ['query' => [
'q' => $query,
'count' => $count,
]];
return $this->client->request(
'GET',
'users/search',
$params
);
} | php | {
"resource": ""
} |
q235183 | UsersRepository.find | train | public function find($username)
{
$response = $this->search($username);
foreach ($response->get() as $user) {
if ($username === $user['username']) {
return $this->get($user['id']);
}
}
return null;
} | php | {
"resource": ""
} |
q235184 | Daemon.bindDefaultTriggers | train | protected function bindDefaultTriggers()
{
$this->handlers[self::EVENT_INIT] = $this->fluentCallback([$this, 'handleInit']);
$this->handlers[self::EVENT_FORK] = $this->fluentCallback([$this, 'handleFork']);
$this->handlers[self::EVENT_START] = $this->fluentCallback([$this, 'handleStart'... | php | {
"resource": ""
} |
q235185 | Daemon.handleInit | train | public function handleInit(Control $control, Context $context)
{
if (! $context->pidfile instanceof Pidfile) {
$context->pidfile = new Pidfile($control, $this->getOption('name'), $this->getOption('lock_dir'));
}
$context->isRunning = $context->pidfile->isActive();
$contex... | php | {
"resource": ""
} |
q235186 | Daemon.handleStart | train | public function handleStart(Control $control, Context $context)
{
if (! $context->pidfile instanceof Pidfile) {
throw new LogicException('Pidfile is not defined');
}
// Activates the circular reference collector
gc_enable();
// Callback for handle when process i... | php | {
"resource": ""
} |
q235187 | CommentThreadAsyncListener.onBlock | train | public function onBlock(BlockEvent $event)
{
$identifier = $event->getSetting('id', null);
if (null === $identifier) {
return;
}
$block = new Block();
$block->setId(uniqid());
$block->setSettings($event->getSettings());
$block->setType($this->blo... | php | {
"resource": ""
} |
q235188 | AbstractTask.addParameter | train | public function addParameter($name, $required = false, $description = '', $default = null)
{
$this->parameters[$name] = [
'name' => $name,
'required' => $required,
'description' => $description,
'default' => $default,
'value' =>... | php | {
"resource": ""
} |
q235189 | AbstractTask.hasParameter | train | public function hasParameter($name)
{
if (array_key_exists($name, $this->parameters)) {
if (null !== $this->parameters[$name]['value']) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q235190 | AbstractTask.replaceTokens | train | private function replaceTokens($option)
{
if (is_array($option)) {
$tokenizedOptions = [];
foreach ($option as $key => $opt) {
$tokenizedOptions[$key] = $this->replaceTokens($opt);
}
return $tokenizedOptions;
}
return preg_rep... | php | {
"resource": ""
} |
q235191 | UrlParserTrait.getPath | train | public function getPath(UriInterface $uri)
{
$path = trim($uri->getPath(), '/');
$parts = explode('/', $path);
if ($parts[0] === 'v'.Client::API_VERSION) {
unset($parts[0]);
}
return '/'.implode('/', $parts);
} | php | {
"resource": ""
} |
q235192 | UrlParserTrait.getQueryParams | train | public function getQueryParams(UriInterface $uri, $exclude = ['sig'], $params = [])
{
parse_str($uri->getQuery(), $params);
foreach ($exclude as $excludedParam) {
if (array_key_exists($excludedParam, $params)) {
unset($params[$excludedParam]);
}
}
... | php | {
"resource": ""
} |
q235193 | SingletonObject.url | train | public function url()
{
if ($this->urlName)
return $this->urlName;
if ($this->objectClass)
return $this->objectClass->url($this);
return null;
} | php | {
"resource": ""
} |
q235194 | SingletonObject.refresh | train | public function refresh()
{
$response = $this->api->get($this->url());
$this->data = (array) $response->data;
return $this;
} | php | {
"resource": ""
} |
q235195 | pakeMercurial.init | train | public static function init($path)
{
pake_mkdirs($path);
pake_sh(escapeshellarg(pake_which('hg')).' init -q '.escapeshellarg($path));
return new pakeMercurial($path);
} | php | {
"resource": ""
} |
q235196 | pakeApp.handle_options | train | public function handle_options($options = null)
{
$this->opt = new pakeGetopt(self::$OPTIONS);
$this->opt->parse($options);
foreach ($this->opt->get_options() as $opt => $value) {
$this->do_option($opt, $value);
}
} | php | {
"resource": ""
} |
q235197 | pakeApp.have_pakefile | train | public function have_pakefile()
{
$is_windows = (strtolower(substr(PHP_OS, 0, 3)) == 'win');
$here = getcwd();
foreach ($this->PAKEFILES as $file) {
$path_includes_directory = basename($file) !== $file;
if ($path_includes_directory) {
if ($is_windows... | php | {
"resource": ""
} |
q235198 | pakeApp.do_option | train | public function do_option($opt, $value)
{
switch ($opt) {
case 'interactive':
$this->interactive = true;
break;
case 'dry-run':
$this->verbose = true;
$this->nowrite = true;
$this->dryrun = true;
... | php | {
"resource": ""
} |
q235199 | pakeApp.help | train | public function help()
{
$this->usage(false);
echo "\n";
echo "available options:";
echo "\n";
foreach (self::$OPTIONS as $option) {
list($long, $short, $mode, $comment) = $option;
if ($mode == pakeGetopt::REQUIRED_ARGUMENT) {
if (preg... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.