_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q249600 | ToolbarDashboards.dashboards | validation | public function dashboards(Environment $environment, $size)
{
//Checks user's rights
$dashboards = null;
if ($this->tokenStorage->getToken()->getUser() !== null) {
//Defines installed dashboards
$dashboardsAvailable = array('ContactForm', 'Email', 'Events', 'Exception... | php | {
"resource": ""
} |
q249601 | QueueCommand.startProcessQueue | validation | private function startProcessQueue()
{
$this->logger->info('Starting queue in process mode');
$dispatcher = new ProcessDispatcher(
$this->client,
$this->logger,
$this->queue,
\array_merge($this->queueConfig, ['process' => $this->config['process']]),
... | php | {
"resource": ""
} |
q249602 | Locale.init | validation | public static function init(RawRequest $request = null)
{
if (self::$isInit === false) {
self::$translations = array();
$settings = Config::getSettings();
if (isset($settings['locale']) === false || isset($settings['locale']['default']) === false) {
throw ... | php | {
"resource": ""
} |
q249603 | Locale.registerTranslations | validation | public static function registerTranslations($baseDir, $localesDir, $prefix = null)
{
if (self::$isInit === true) {
$dir = $baseDir . DIRECTORY_SEPARATOR . $localesDir;
if (is_dir($dir) === false) {
throw new InvalidDirectory('directory "' . $dir . '" can\'t be identif... | php | {
"resource": ""
} |
q249604 | Locale.translate | validation | public static function translate($key, array $args = array())
{
if (self::$isInit === false) {
throw new BadUse('locale doesn\'t seem to have been initialized');
}
$oldKey = $key;
$section = self::$translations;
while (isset($section[$key]) === false && ($pos = st... | php | {
"resource": ""
} |
q249605 | Locale.setCurrentLanguage | validation | public static function setCurrentLanguage($language)
{
self::$currentLanguage = $language;
Session::set('_stray_language', self::$currentLanguage);
setlocale(LC_ALL, $language);
} | php | {
"resource": ""
} |
q249606 | PostTimelineSubscriber.createPostTimelineEntry | validation | public function createPostTimelineEntry(EntityPublishedEvent $event): void
{
// Only act on post objects.
$post = $event->getObject();
if (!$post instanceof Post) {
return;
}
// Get the author for the post.
$author = $this->user_provider->loadUserByUserna... | php | {
"resource": ""
} |
q249607 | Mapping.registerMapping | validation | public static function registerMapping(array $config)
{
self::validateConfig($config);
if (isset(self::$mappings[$config['name']]) === false) {
self::$mappings[$config['name']] = array(
'config' => $config
);
Database::registerDatabase($config['dat... | php | {
"resource": ""
} |
q249608 | Mapping.get | validation | public static function get(string $name) : array
{
if (isset(self::$mappings[$name]) === false) {
throw new MappingNotFound('there\'s no registered mapping with name "' . $name . '"');
}
return self::$mappings[$name];
} | php | {
"resource": ""
} |
q249609 | Mapping.validateConfig | validation | private static function validateConfig(array $config)
{
if (isset($config['name']) === false) {
throw new BadUse('there\'s no name in mapping configuration');
}
if (isset($config['schema']) === false) {
throw new BadUse('there\'s no schema in mapping configuration');
... | php | {
"resource": ""
} |
q249610 | BoardController.archiveAction | validation | public function archiveAction(
string $production_slug,
AuthorizationCheckerInterface $auth,
PaginatorInterface $paginator,
Request $request
): Response {
// Lookup the production by production_slug.
$production_repo = $this->em->getRepository(Production::class);
... | php | {
"resource": ""
} |
q249611 | BatchEmailJob.perform | validation | public function perform(array $args = []): int
{
// Store our args
$this->args = $args;
unset($this->args['messages']);
// Create a new transport
$transport = new Swift_SmtpTransport(
$args['smtp']['host'],
$args['smtp']['port']
);
$tr... | php | {
"resource": ""
} |
q249612 | BatchEmailJob.shutdown | validation | protected function shutdown()
{
// Indicate to our main loop that we should stop processing additonal messages
$this->shutdown = true;
// Get a list of all the messages that have not yet been handled
$this->args['messages'] = array_filter($this->messages, function($message) ... | php | {
"resource": ""
} |
q249613 | Controller.help | validation | public function help(Request $request)
{
$routes = Console::getRoutes();
echo 'strayFw console help screen' . PHP_EOL . 'Available actions :' . PHP_EOL . PHP_EOL;
$namespace = null;
foreach ($routes as $route) {
if ($namespace != $route['namespace']) {
$na... | php | {
"resource": ""
} |
q249614 | ProcessWorkerCommand.configure | validation | protected function configure()
{
$this->setName('worker/process')
->setHidden(true)
->setDescription('Runs a given worker')
->setDefinition(new InputDefinition([
new InputOption('config', 'c', InputOption::VALUE_REQUIRED, 'A YAML configuration file'),
... | php | {
"resource": ""
} |
q249615 | Update.set | validation | public function set($set)
{
if (is_array($set) === true) {
$this->set = '';
foreach ($set as $name => $value) {
$pos = stripos($name, '.');
if ($pos !== false) {
$this->set .= substr($name, $pos + 1);
} else {
... | php | {
"resource": ""
} |
q249616 | Update.where | validation | public function where($where)
{
$this->where = ($where instanceof Condition ? $where : new Condition($where));
return $this;
} | php | {
"resource": ""
} |
q249617 | Update.orderBy | validation | public function orderBy($orderBy)
{
if (is_array($orderBy) === true) {
$this->orderBy = '';
foreach ($orderBy as $key => $elem) {
$this->orderBy .= $key . ' ' . $elem . ', ';
}
$this->orderBy = substr($this->orderBy, 0, -2);
} else {
... | php | {
"resource": ""
} |
q249618 | Session.init | validation | public static function init()
{
if (self::$isInit === false) {
if (session_id() == null) {
$settings = Config::getSettings();
session_name(isset($settings['session_name']) === true ? $settings['session_name'] : 'stray_session');
if (isset($settings... | php | {
"resource": ""
} |
q249619 | ArrayContainer.setAction | validation | public function setAction(AbstractAction $action)
{
$this->action = $action;
$this->action->setArrayContainer($this);
return $this;
} | php | {
"resource": ""
} |
q249620 | ArrayContainer.getNested | validation | public function getNested($keyString, $default = null, $separator = '.')
{
$keys = explode($separator, $keyString);
$data = $this->array;
foreach ($keys as $key) {
if(!is_array($data) or !array_key_exists($key, $data)) {
return $default;
}
... | php | {
"resource": ""
} |
q249621 | ArrayContainer.applyFilters | validation | protected function applyFilters($value, $key)
{
foreach ($this->filters as $filter) {
$value = $filter($value, $key);
}
return $value;
} | php | {
"resource": ""
} |
q249622 | Select.execute | validation | public function execute()
{
if ($this->statement == null) {
$this->statement = Database::get($this->database)->{($this->isCritical === true ? 'getMasterLink' : 'getLink')}()->prepare($this->toSql());
}
foreach ($this->parameters as $name => $value) {
$type = \PDO::PAR... | php | {
"resource": ""
} |
q249623 | Select.fetch | validation | public function fetch()
{
if ($this->statement == null || $this->getErrorState() != '00000') {
return false;
}
return $this->statement->fetch(\PDO::FETCH_ASSOC);
} | php | {
"resource": ""
} |
q249624 | Select.fetchAll | validation | public function fetchAll()
{
if ($this->statement == null || $this->getErrorState() != '00000') {
return false;
}
return $this->statement->fetchAll(\PDO::FETCH_ASSOC);
} | php | {
"resource": ""
} |
q249625 | Select.select | validation | public function select($select)
{
if (is_array($select) === true) {
$this->select = '';
foreach ($select as $key => $elem) {
$this->select .= $elem;
if (is_numeric($key) === false) {
$this->select .= ' AS ' . $key;
}... | php | {
"resource": ""
} |
q249626 | Select.groupBy | validation | public function groupBy($groupBy)
{
if (is_array($groupBy) === true) {
$this->groupBy = implode(', ', $groupBy);
} else {
$this->groupBy = $groupBy;
}
return $this;
} | php | {
"resource": ""
} |
q249627 | Select.having | validation | public function having($having)
{
$this->having = ($having instanceof Condition ? $having : new Condition($having));
return $this;
} | php | {
"resource": ""
} |
q249628 | Select.distinct | validation | public function distinct($distinct)
{
if (is_array($distinct) === true) {
$this->distinct = implode(', ', $distinct);
} else {
$this->distinct = $distinct;
}
return $this;
} | php | {
"resource": ""
} |
q249629 | Select.addInnerJoin | validation | public function addInnerJoin($table, $on)
{
$this->innerJoins[] = array(
'table' => $table,
'on' => ($on instanceof Condition ? $on : new Condition($on))
);
return $this;
} | php | {
"resource": ""
} |
q249630 | Select.addLeftOuterJoin | validation | public function addLeftOuterJoin($table, $on)
{
$this->leftOuterJoins[] = array(
'table' => $table,
'on' => ($on instanceof Condition ? $on : new Condition($on))
);
return $this;
} | php | {
"resource": ""
} |
q249631 | Select.addRightOuterJoin | validation | public function addRightOuterJoin($table, $on)
{
$this->rightOuterJoins[] = array(
'table' => $table,
'on' => ($on instanceof Condition ? $on : new Condition($on))
);
return $this;
} | php | {
"resource": ""
} |
q249632 | Select.addFullOuterJoin | validation | public function addFullOuterJoin($table, $on)
{
$this->fullOuterJoins[] = array(
'table' => $table,
'on' => ($on instanceof Condition ? $on : new Condition($on))
);
return $this;
} | php | {
"resource": ""
} |
q249633 | Console.routes | validation | public function routes(Request $request)
{
$table = new \cli\Table();
$table->setHeaders([ 'Type', 'Subdomain', 'Method', 'Path', 'Action' ]);
$rows = [];
$routes = Http::getRoutes();
usort($routes, function (array $a, array $b) {
if ($a['subdomain'] != $b['subdom... | php | {
"resource": ""
} |
q249634 | Console.run | validation | public static function run()
{
if (self::$isInit === true) {
self::$request = new Request(self::$routes);
self::$controllers = array();
try {
$before = self::$request->getBefore();
foreach ($before as $b) {
$controller =... | php | {
"resource": ""
} |
q249635 | Console.before | validation | public static function before(string $path, string $usage, string $help, string $action)
{
if (self::$isInit === true) {
self::$routes[] = array(
'type' => 'before',
'path' => $path,
'usage' => $usage,
'help' => $help,
... | php | {
"resource": ""
} |
q249636 | Logger.get | validation | public static function get() : Logger
{
if (self::$log == null) {
self::$log = new Logger();
}
return self::$log;
} | php | {
"resource": ""
} |
q249637 | Migration.ensureTable | validation | public static function ensureTable(array $mapping) : bool
{
$database = Database::get($mapping['config']['database']);
$statement = 'CREATE TABLE IF NOT EXISTS _stray_migration (';
$statement .= 'date TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL, ';
$statement .= 'migration VARCHAR(2... | php | {
"resource": ""
} |
q249638 | Schema.getDefinition | validation | public function getDefinition() : array
{
if ($this->definition == null) {
$data = Mapping::get($this->mapping);
$this->definition = Config::get($data['config']['schema']);
}
return $this->definition;
} | php | {
"resource": ""
} |
q249639 | Schema.getSchema | validation | public static function getSchema(string $mapping) : Schema
{
$data = Mapping::get($mapping);
$class = rtrim(ucfirst($data['config']['provider']), '\\') . '\\Schema';
return new $class($mapping);
} | php | {
"resource": ""
} |
q249640 | ToolbarDisplay.display | validation | public function display(Environment $environment, $template, $type = null, $size = 'md', $object = null)
{
//Defines tools
$tools = $environment->render($template, array(
'type' => $type,
'object' => $object,
));
//Defines toolbar
return $... | php | {
"resource": ""
} |
q249641 | ToolbarButtonText.button | validation | public function button(Environment $environment, $link, $button, $size = 'md', $iconDisplay = 'true', $location = 'right', $label = null, $userStyle = null)
{
//Defines $icon and $style
extract($this->toolbarService->defineButton($button));
//Defines button
return $environment->rend... | php | {
"resource": ""
} |
q249642 | Response.render | validation | public function render(RenderInterface $render, $status = 200)
{
$this->renderInst = $render;
$this->status = $status;
} | php | {
"resource": ""
} |
q249643 | Bootstrap.init | validation | public static function init()
{
if (self::$isInit === false) {
self::$namespaces = array();
self::$applications = array();
spl_autoload_register(__CLASS__ . '::loadClass');
self::$isInit = true;
Console::init();
Console::prefix('\\Rockn... | php | {
"resource": ""
} |
q249644 | Bootstrap.loadClass | validation | public static function loadClass(string $className)
{
if (self::$isInit === false) {
throw new BadUse('bootstrap doesn\'t seem to have been initialized');
}
$fileName = null;
if (($namespacePos = strripos($className, '\\')) !== false) {
$namespacePos = (int) $... | php | {
"resource": ""
} |
q249645 | Bootstrap.registerApp | validation | public static function registerApp(string $namespace, string $path = null)
{
$namespace = rtrim($namespace, '\\');
if ($path == null) {
$path = constant('STRAY_PATH_APPS') . str_replace(
'_',
DIRECTORY_SEPARATOR,
str_replace('\\', DIRECTORY... | php | {
"resource": ""
} |
q249646 | Bootstrap.run | validation | public static function run()
{
if (self::$isInit === false) {
throw new BadUse('bootstrap doesn\'t seem to have been initialized');
}
foreach (self::$namespaces as $name => $path) {
if (is_readable($path . DIRECTORY_SEPARATOR . 'init.php') === true) {
... | php | {
"resource": ""
} |
q249647 | IconChooser.getModelName | validation | private function getModelName() {
// Provided name will override
if( isset( $this->class ) ) {
return $this->class;
}
// Return class name if model is given
if( isset( $this->model ) ) {
$rClass = new \ReflectionClass( $this->model );
return $rClass->getShortName();
}
return 'Icon';
} | php | {
"resource": ""
} |
q249648 | IconChooser.getIcon | validation | private function getIcon() {
// Provided name will override
if( isset( $this->model ) ) {
$icon = $this->attribute;
if( isset( $this->model->$icon ) ) {
return $this->model->$icon;
}
}
if( isset( $this->icon ) ) {
return $this->icon;
}
return $this->default;
} | php | {
"resource": ""
} |
q249649 | Cookie.set | validation | public static function set($name, $value, $expire = 0, $path = null)
{
if ($path === null) {
setcookie($name, $value, $expire);
} else {
setcookie($name, $value, $expire, $path);
}
} | php | {
"resource": ""
} |
q249650 | Cookie.clear | validation | public static function clear()
{
$keys = array_keys($_COOKIE);
foreach ($keys as $key) {
setcookie($key, '', time() - 1);
}
} | php | {
"resource": ""
} |
q249651 | Database.connect | validation | public function connect()
{
if ($this->isConnected() === false) {
try {
if (isset($this->servers['all']) === true) {
$dsn = $this->providerDatabase->getDsn($this->servers['all']);
$this->servers['all']['link'] = new \PDO($dsn, $this->server... | php | {
"resource": ""
} |
q249652 | Database.disconnect | validation | public function disconnect()
{
if (isset($this->servers['all']) === true) {
unset($this->servers['all']['link']);
} else {
unset($this->servers['read']['link']);
unset($this->servers['write']['link']);
}
} | php | {
"resource": ""
} |
q249653 | Database.isConnected | validation | public function isConnected() : bool
{
if (isset($this->servers['all']) === true) {
return isset($this->servers['all']['link']);
}
return isset($this->servers['read']['link']) && isset($this->servers['write']['link']);
} | php | {
"resource": ""
} |
q249654 | Database.getLink | validation | public function getLink()
{
if ($this->isConnected() === false) {
$this->connect();
}
if (isset($this->servers['all']) === true) {
return $this->servers['all']['link'];
}
if ($this->transactionLevel >= 1) {
return $this->servers['write']['l... | php | {
"resource": ""
} |
q249655 | Database.getMasterLink | validation | public function getMasterLink()
{
if ($this->isConnected() === false) {
$this->connect();
}
if (isset($this->servers['all']) === true) {
return $this->servers['all']['link'];
}
return $this->servers['write']['link'];
} | php | {
"resource": ""
} |
q249656 | Database.beginTransaction | validation | public function beginTransaction() : bool
{
if ($this->isConnected() === false) {
$this->connect();
}
++$this->transactionLevel;
if ($this->transactionLevel == 1) {
return $this->providerDatabase->beginTransaction($this->GetMasterLink());
}
re... | php | {
"resource": ""
} |
q249657 | Database.commit | validation | public function commit() : bool
{
if ($this->isConnected() === false) {
$this->connect();
}
if ($this->transactionLevel > 0) {
--$this->transactionLevel;
if ($this->transactionLevel == 0) {
return $this->providerDatabase->commit($this->GetM... | php | {
"resource": ""
} |
q249658 | Database.rollBack | validation | public function rollBack() : bool
{
if ($this->isConnected() === false) {
$this->connect();
}
if ($this->transactionLevel > 0) {
--$this->transactionLevel;
if ($this->transactionLevel == 0) {
return $this->providerDatabase->rollBack($this->... | php | {
"resource": ""
} |
q249659 | Database.registerDatabase | validation | public static function registerDatabase(string $alias)
{
if (isset(self::$databases[$alias]) === false) {
self::$databases[$alias] = new static($alias);
}
} | php | {
"resource": ""
} |
q249660 | Database.get | validation | public static function get(string $alias)
{
if (isset(self::$databases[$alias]) === false) {
throw new DatabaseNotFound('database "' . $alias . '" doesn\'t seem to be registered');
}
return self::$databases[$alias];
} | php | {
"resource": ""
} |
q249661 | TextureChooser.renderWidget | validation | public function renderWidget( $config = [] ) {
$widgetHtml = $this->render( $this->template, [
'name' => $this->getModelName(),
'attribute' => $this->attribute,
'label' => $this->label,
'texture' => $this->getTexture(),
'disabled' => $this->disabled
]);
if( $this->wrap ) {
return Html::tag( $... | php | {
"resource": ""
} |
q249662 | TextureChooser.getTexture | validation | private function getTexture() {
// Provided name will override
if( isset( $this->model ) ) {
$texture = $this->attribute;
if( isset( $this->model->$texture ) ) {
return $this->model->$texture;
}
}
if( isset( $this->texture ) ) {
return $this->texture;
}
return $this->default;
} | php | {
"resource": ""
} |
q249663 | ProductionMenuSubscriber.addNoticeBoardItem | validation | public function addNoticeBoardItem(ProductionMenuCollectionEvent $event): void
{
$menu = $event->getMenu();
$group = $event->getGroup();
// Create notice_board menu item.
$board = $this->factory->createItem('menu_item.notice_board', [
'route' => 'bkstg_board_show',
... | php | {
"resource": ""
} |
q249664 | Console.mappings | validation | public function mappings(Request $request)
{
$table = new \cli\Table();
$table->setHeaders([ 'Mapping', 'Database', 'Models path' ]);
$rows = [];
$mappings = Mapping::getMappings();
usort($mappings, function (array $a, array $b) {
return strcmp($a['config']['name'... | php | {
"resource": ""
} |
q249665 | Console.generate | validation | public function generate(Request $request)
{
if (count($request->getArgs()) != 1) {
echo 'Wrong arguments.' . PHP_EOL . 'Usage : db/generate mapping_name' . PHP_EOL;
} else {
$mapping = $request->getArgs()[0];
$schema = Schema::getSchema($mapping);
$sc... | php | {
"resource": ""
} |
q249666 | PostRepository.getAllActiveQuery | validation | public function getAllActiveQuery(Production $production): Query
{
$qb = $this->createQueryBuilder('p');
return $qb
->join('p.groups', 'g')
// Add conditions.
->andWhere($qb->expr()->eq('g', ':group'))
->andWhere($qb->expr()->eq('p.active', ':active'... | php | {
"resource": ""
} |
q249667 | PostRepository.getAllInactiveQuery | validation | public function getAllInactiveQuery(Production $production): Query
{
$qb = $this->createQueryBuilder('p');
return $qb
->join('p.groups', 'g')
// Add conditions.
->andWhere($qb->expr()->eq('g', ':group'))
->andWhere($qb->expr()->isNull('p.parent'))
... | php | {
"resource": ""
} |
q249668 | Controllers.get | validation | public static function get(string $class)
{
if (isset(self::$controllers[$class]) === false) {
self::$controllers[$class] = new $class();
}
return self::$controllers[$class];
} | php | {
"resource": ""
} |
q249669 | IconManager.getFileIcon | validation | public function getFileIcon( $fileType, $iconLib = 'cmti' ) {
switch( $iconLib ) {
case 'cmti': {
return $this->getCmtiFileIcon( $fileType );
}
case 'fa': {
return $this->getFaFileIcon( $fileType );
}
}
} | php | {
"resource": ""
} |
q249670 | IconManager.getCmtiFileIcon | validation | protected function getCmtiFileIcon( $fileType ) {
switch( $fileType ) {
case FileManager::FILE_TYPE_IMAGE: {
return 'cmti-image';
}
case FileManager::FILE_TYPE_VIDEO: {
return 'cmti-file-video';
}
case FileManager::FILE_TYPE_AUDIO: {
return 'cmti-file-audio';
}
case FileManager::... | php | {
"resource": ""
} |
q249671 | IconManager.getFaFileIcon | validation | protected function getFaFileIcon( $fileType ) {
switch( $fileType ) {
case FileManager::FILE_TYPE_IMAGE: {
return 'fa-file-image';
}
case FileManager::FILE_TYPE_VIDEO: {
return 'fa-file-video';
}
case FileManager::FILE_TYPE_AUDIO: {
return 'fa-file-audio';
}
case FileManager::FIL... | php | {
"resource": ""
} |
q249672 | Dispatcher.start | validation | public function start()
{
Loop::run(function () {
$this->logger->info(sprintf("RPQ is now started, and is listening for new jobs every %d ms", $this->config['poll_interval']), [
'queue' => $this->queue->getName()
]);
$this->setIsRunning(false);
... | php | {
"resource": ""
} |
q249673 | Database.getDsn | validation | public function getDsn(array $info) : string
{
$dsn = 'pgsql:host=';
$dsn .= (isset($info['host']) === true ? $info['host'] : 'localhost') . ';';
if (isset($info['port']) === true) {
$dsn .= 'port=' . $info['port'] . ';';
}
$dsn .= 'dbname=' . $info['name'] . ';';... | php | {
"resource": ""
} |
q249674 | Migration.migrate | validation | public function migrate(Request $req)
{
if (count($req->getArgs()) != 1) {
echo 'Wrong arguments.' . PHP_EOL . 'Usage : db/migration/migrate mapping_name' . PHP_EOL;
} else {
$mappingName = $req->getArgs()[0];
$mapping = Mapping::get($mappingName);
$cl... | php | {
"resource": ""
} |
q249675 | Migration.write | validation | private function write(array $mapping, string $mappingName, string $name, array $up = [], array $down = [], array $import = [])
{
$path = rtrim($mapping['config']['migrations']['path'], DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR;
$path .= $name . DIRECTORY_SEPARATOR;
if (file_exists($path . ... | php | {
"resource": ""
} |
q249676 | Model.delete | validation | public function delete() : bool
{
$status = false;
if ($this->new === false) {
$deleteQuery = new Delete($this->getDatabaseName());
$deleteQuery->from($this->getTableName());
$where = array();
foreach ($this->getPrimary() as $primary) {
... | php | {
"resource": ""
} |
q249677 | Model.fetchArray | validation | public static function fetchArray(array $conditions, array $orderBy = null, bool $critical = false)
{
$entity = new static();
$selectQuery = new Select($entity->getDatabaseName(), $critical);
$selectQuery->select($entity->getAllFieldsRealNames());
$selectQuery->from($entity->getTable... | php | {
"resource": ""
} |
q249678 | Model.countRows | validation | public static function countRows(array $conditions, bool $critical = false)
{
$entity = new static();
$selectQuery = new Select($entity->getDatabaseName(), $critical);
$selectQuery->select([ 'count' => 'COUNT(*)' ]);
$selectQuery->from($entity->getTableName());
if (count($con... | php | {
"resource": ""
} |
q249679 | PostLinkSubscriber.setPostLink | validation | public function setPostLink(TimelineLinkEvent $event): void
{
$action = $event->getAction();
if (!in_array($action->getVerb(), ['post', 'reply'])) {
return;
}
$production = $action->getComponent('indirectComplement')->getData();
$post = $action->getComponent('di... | php | {
"resource": ""
} |
q249680 | IncludePanel.completeFilesCountsAndEditorLinks | validation | protected static function completeFilesCountsAndEditorLinks () {
if (!static::$files) {
$rawList = get_included_files();
$list = [];
$docRoot = str_replace('\\', '/', $_SERVER['DOCUMENT_ROOT']);
$docRootLength = mb_strlen($docRoot);
$tracyFileDetectionSubstr = '/tracy';
foreach ($rawList as & $file)... | php | {
"resource": ""
} |
q249681 | PostController.createAction | validation | public function createAction(
string $production_slug,
Request $request,
TokenStorageInterface $token,
AuthorizationCheckerInterface $auth
): Response {
// Lookup the production by production_slug.
$production_repo = $this->em->getRepository(Production::class);
... | php | {
"resource": ""
} |
q249682 | PostController.updateAction | validation | public function updateAction(
string $production_slug,
int $id,
Request $request,
TokenStorageInterface $token,
AuthorizationCheckerInterface $auth
): Response {
// Lookup the post and production.
list($post, $production) = $this->lookupEntity(Post::class, $id... | php | {
"resource": ""
} |
q249683 | RenderJson.render | validation | public function render(array $args, bool $prettyPrint = null)
{
header('Content-type: application/json');
if ((constant('STRAY_ENV') === 'development' && $prettyPrint !== false) || $prettyPrint === true) {
return (string) json_encode($args, JSON_PRETTY_PRINT);
}
return (... | php | {
"resource": ""
} |
q249684 | JobHandler.exit | validation | public function exit($id, $pid, $code, $forceRetry = false, $queueBackoffTime = null)
{
$this->logger->info('Job ended', [
'exitCode' => $code,
'pid' => $pid,
'jobId' => $id,
'queue' => $this->queue->getName()
]);
$hash = explode(':', $id);
... | php | {
"resource": ""
} |
q249685 | TwitterDriver.matchesRequest | validation | public function matchesRequest()
{
if (isset($this->headers['x-twitter-webhooks-signature'])) {
$signature = $this->headers['x-twitter-webhooks-signature'][0];
$hash = hash_hmac('sha256', json_encode($this->payload->all()), $this->config->get('consumer_secret'), true);
... | php | {
"resource": ""
} |
q249686 | TwitterDriver.getUser | validation | public function getUser(IncomingMessage $matchingMessage)
{
$sender_id = $matchingMessage->getRecipient();
$user = Collection::make($this->payload->get('users'))->first(function ($user) use ($sender_id) {
return $user['id'] === $sender_id;
});
return new User($user['id'... | php | {
"resource": ""
} |
q249687 | TwitterDriver.convertQuestion | validation | private function convertQuestion(Question $question)
{
$buttons = Collection::make($question->getButtons())->map(function ($button) {
return [
'label' => $button['text'],
'metadata' => $button['value']
];
});
return [
'text... | php | {
"resource": ""
} |
q249688 | TwitterDriver.sendRequest | validation | public function sendRequest($endpoint, array $parameters, IncomingMessage $matchingMessage)
{
$this->connection->post($endpoint, $parameters, true);
return Response::create($this->connection->getLastBody(), $this->connection->getLastHttpCode());
} | php | {
"resource": ""
} |
q249689 | TgCommands.broadcastMsg | validation | public function broadcastMsg(array $peers, $msg)
{
$peerList = $this->formatPeers($peers);
return $this->exec('broadcast ' . $peerList . ' ' . $msg);
} | php | {
"resource": ""
} |
q249690 | TgCommands.contactAdd | validation | public function contactAdd($phoneNumber, $firstName, $lastName)
{
$phoneNumber = $this->formatPhoneNumber($phoneNumber);
return $this->exec('add_contact ' . $phoneNumber . ' ' . $this->escapeStringArgument($firstName)
. ' ' . $this->escapeStringArgument($lastName));
} | php | {
"resource": ""
} |
q249691 | TgCommands.contactRename | validation | public function contactRename($contact, $firstName, $lastName)
{
$contact = $this->escapePeer($contact);
$firstName = $this->escapeStringArgument($firstName);
$lastName = $this->escapeStringArgument($lastName);
return $this->exec('rename_contact ' . $contact . ' ' . $firstName . ... | php | {
"resource": ""
} |
q249692 | TgCommands.setProfilePhoto | validation | public function setProfilePhoto($mediaUri)
{
//Process the requested media file.
$processedMedia = $this->processMediaUri($mediaUri);
if ( ! $processedMedia) {
return false;
}
//Send media file.
$result = $this->exec('set_profile_photo ' . $processedMedia... | php | {
"resource": ""
} |
q249693 | TgCommands.checkUrlExistsAndSize | validation | protected function checkUrlExistsAndSize($fileUri, array $mediaFileInfo)
{
$mediaFileInfo['url'] = $fileUri;
//File is a URL. Create a curl connection but DON'T download the body content
//because we want to see if file is too big.
$curl = curl_init();
curl_setopt($curl, CURL... | php | {
"resource": ""
} |
q249694 | TgCommands.determineFilename | validation | protected function determineFilename($originalFilename, array $mediaFileInfo)
{
if (is_null($originalFilename) || ! isset($originalFilename) || is_file(sys_get_temp_dir() . '/' . $originalFilename)) {
//Need to create a unique file name as file either exists or we couldn't determine it.
... | php | {
"resource": ""
} |
q249695 | TgCommands.downloadMediaFileFromURL | validation | protected function downloadMediaFileFromURL($fileUri, $tempFileName)
{
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, "$fileUri");
curl_setopt($curl, CURLOPT_USERAGENT,
"Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11) Gecko/20071127 Firefox/2.0.0.11");
... | php | {
"resource": ""
} |
q249696 | DrushStack.argsForNextCommand | validation | protected function argsForNextCommand($args)
{
if (!is_array($args)) {
$args = func_get_args();
}
$this->argumentsForNextCommand .= ' ' . implode(' ', $args);
return $this;
} | php | {
"resource": ""
} |
q249697 | DrushStack.drush | validation | public function drush($command, $assumeYes = true)
{
if (is_array($command)) {
$command = implode(' ', array_filter($command));
}
return $this->exec($this->injectArguments($command, $assumeYes));
} | php | {
"resource": ""
} |
q249698 | DrushStack.injectArguments | validation | protected function injectArguments($command, $assumeYes)
{
$cmd =
$this->siteAlias . ' '
. $command
. ($assumeYes ? ' -y': '')
. $this->arguments
. $this->argumentsForNextCommand;
$this->argumentsForNextCommand = '';
return $cmd;
... | php | {
"resource": ""
} |
q249699 | DrushStack.updateDb | validation | public function updateDb()
{
$this->printTaskInfo('Do database updates');
$this->drush('updb');
$drushVersion = $this->getVersion();
if (-1 === version_compare($drushVersion, '6.0')) {
$this->printTaskInfo('Will clear cache after db updates for drush '
. $... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.