_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q263800 | Tokenizer._findEndOfQuotedString | test | protected function _findEndOfQuotedString($quote, $start) {
$nextEscape = strpos($this->_css, '\\', $start + 1);
$end = strpos($this->_css, $quote, $start + 1);
if ($end === false) {
// Invalid string
return false;
}
while ($nextEscape !== false && $next... | php | {
"resource": ""
} |
q263801 | Tokenizer._findEndOfURL | test | protected function _findEndOfURL($start = 0) {
$length = strlen($this->_css);
$index = $start + 4;
while ($index < $length) {
$next = substr($this->_css, $index, 1);
switch ($next) {
case '"':
case '\'':
// quoted url
... | php | {
"resource": ""
} |
q263802 | Tokenizer._checkRule | test | protected function _checkRule($words, $extra, $ignoreErrors) {
$pairs = $this->_findRulePairs($words);
if (is_bool($pairs)) {
$value = $this->_mergeWords($words) . $extra;
if (!strlen($value)) {
return false;
}
$index = $words[0]['index']... | php | {
"resource": ""
} |
q263803 | Tokenizer._mergeWords | test | protected function _mergeWords($words) {
$value = '';
foreach ($words as $word) {
$value .= $word['text'];
}
return trim($value);
} | php | {
"resource": ""
} |
q263804 | Tokenizer._checkSelectors | test | protected function _checkSelectors($words) {
$selectors = $this->_getSelectors($words);
$result = [
'token' => '{',
'code' => $this->_mergeWords($words),
'index' => $words[0]['index'],
];
if (!count($selectors)) {
return $result;
... | php | {
"resource": ""
} |
q263805 | Tokenizer._getSelectors | test | protected function _getSelectors($words) {
$selectors = [];
$selector = '';
foreach ($words as $word) {
if ($word['type'] !== 'text') {
$selector .= $word['text'];
continue;
}
$list = explode(',', $word['text']);
$... | php | {
"resource": ""
} |
q263806 | Tokenizer._parseTokens | test | protected function _parseTokens($item) {
$results = [];
while ($item !== null) {
switch ($item['token']) {
case '}':
return $results;
case '{':
$item['children'] = $this->_parseTokens(array_shift($this->_tokens));
... | php | {
"resource": ""
} |
q263807 | Helper.setCurrentAppKeyForRequest | test | public static function setCurrentAppKeyForRequest($key, Request $request = null)
{
$request = $request ?: app('request');
$request->attributes->set(static::CURRENT_APP_KEY, $key);
return $request;
} | php | {
"resource": ""
} |
q263808 | Helper.getCurrentAppKey | test | public static function getCurrentAppKey(Request $request = null)
{
$request = $request ?: app('request');
return $request->attributes->get(static::CURRENT_APP_KEY);
} | php | {
"resource": ""
} |
q263809 | Helper.addAcceptableJsonTypeForRequest | test | public static function addAcceptableJsonTypeForRequest(Closure $determination = null, Closure $callback = null)
{
app()->rebinding('request', function ($app, Request $request) use ($determination, $callback) {
if (is_null($determination) || $determination($request)) {
$accept = $... | php | {
"resource": ""
} |
q263810 | GetMaxDateBalance.build | test | public function build(\Magento\Framework\DB\Select $source = null)
{
/* this is root query builder (started from SELECT) */
$result = $this->conn->select();
/* define tables aliases for internal usage (in this method) */
$asAcc = self::AS_ACC;
$asBal = self::AS_BAL;
... | php | {
"resource": ""
} |
q263811 | Unpublish.unpublishPost | test | public function unpublishPost($postId, $action = 'trash')
{
$postStatus = get_post_status($postId);
if (!in_array($postStatus, array('publish', 'private', 'password', 'draft'))) {
return false;
}
switch ($action) {
case 'draft':
wp_update_post... | php | {
"resource": ""
} |
q263812 | Unpublish.saveUnpublish | test | public function saveUnpublish($postId)
{
// Do not proceed if post is a revision
if (wp_is_post_revision($postId)) {
return false;
}
$args = array(
'post_id' => $postId
);
wp_unschedule_event(wp_next_scheduled('unpublish_post', $args), 'unpub... | php | {
"resource": ""
} |
q263813 | Unpublish.initScheduler | test | public function initScheduler($postId) : bool
{
$active = true;
$post_types = get_field('content_scheduler_posttypes', 'option');
if (is_array($post_types) && !empty($post_types)) {
$current = get_post_type($postId);
$active = in_array($current, $post_types);
... | php | {
"resource": ""
} |
q263814 | Token.generate | test | public function generate($key, $secret, $time)
{
if ($key && $secret && $time) {
return substr(md5($key.$secret.$time), 10, 20);
}
} | php | {
"resource": ""
} |
q263815 | Token.generateForKey | test | public function generateForKey($key, $time)
{
if ($secret = $this->client->getAppSecretForKey($key)) {
return $this->generate($key, $secret, $time);
}
} | php | {
"resource": ""
} |
q263816 | Token.verify | test | public function verify($token, $key, $time)
{
return $token && $key && $time && $token === $this->generateForKey($key, $time);
} | php | {
"resource": ""
} |
q263817 | Token.generateHttpHeaders | test | public function generateHttpHeaders($appKey, $time = null)
{
$headers = [];
foreach ($this->generateDataForKey($appKey, $time) as $key => $value) {
$headers['X-API-'.strtoupper($key)] = $value;
}
return $headers;
} | php | {
"resource": ""
} |
q263818 | Token.generateQueryData | test | public function generateQueryData($appKey, $time = null)
{
$query = [];
foreach ($this->generateDataForKey($appKey, $time) as $key => $value) {
$query['_'.$key] = $value;
}
return $query;
} | php | {
"resource": ""
} |
q263819 | SysCustomer.getId | test | public function getId()
{
if (is_null($this->cacheId)) {
$conn = $this->daoGeneric->getConnection();
$entity = Cfg::ENTITY_MAGE_CUSTOMER;
$cols = [Cfg::E_CUSTOMER_A_ENTITY_ID];
$quoted = $conn->quote(Cfg::SYS_CUSTOMER_EMAIL);
$where = Cfg::E_CUSTOM... | php | {
"resource": ""
} |
q263820 | Builder.fit | test | public function fit($gravity = null)
{
$this->manipulations['c'] = 'fit';
if (!is_null($gravity)) {
$this->manipulations['g'] = $gravity;
}
return $this;
} | php | {
"resource": ""
} |
q263821 | Builder.getManipulations | test | public function getManipulations()
{
$manipulations = array_map(function ($key) {
return $key . '_' . $this->manipulations[$key];
}, array_keys($this->manipulations ?: []));
return implode(',', $manipulations);
} | php | {
"resource": ""
} |
q263822 | Transaction.create | test | public function create($data)
{
$result = parent::create($data);
if ($result) {
/* update balances for accounts */
if (is_array($data)) {
$data = new Entity($data);
}
$value = $data->getValue();
$creditAccId = $data->getCred... | php | {
"resource": ""
} |
q263823 | TFillable.fill | test | public function fill(array $Values) {
foreach ($Values as $name => $value){
if (!property_exists($this, $name)){
throw new \Exception('Undefined property "' . $name . '"!');
}
$this->{$name} = $value;
}
} | php | {
"resource": ""
} |
q263824 | URI.getUri | test | public function getUri($start = self::SCHEME, $end = self::FRAGMENT)
{
$result = '';
switch ($start) {
default:
case static::SCHEME:
$scheme = $this->getScheme();
if ($scheme) {
$result .= $scheme . static::DELIMITER_SCHEME;
}
if ($end === static::SCHEME) {
break;
}
// n... | php | {
"resource": ""
} |
q263825 | URI.setUserInfo | test | private function setUserInfo($username, $password = null)
{
$this->username = $username;
$this->password = $password;
return $this;
} | php | {
"resource": ""
} |
q263826 | URI.setPort | test | private function setPort($port = null)
{
if ($port !== null && (1 > $port || 0xffff < $port)) {
throw new \InvalidArgumentException('Invalid port');
}
$this->port = $port;
return $this;
} | php | {
"resource": ""
} |
q263827 | URI.setPath | test | private function setPath($path)
{
$directory = dirname($path);
$file = basename($path);
// If dirname is '.'. Then remove it.
if ($directory === '.') {
$directory = '';
}
// If the path ends with '/'. Then there is no file.
if (substr($path, -1) === static::DELIMITER_PATH) {
$directory = $path;
... | php | {
"resource": ""
} |
q263828 | URI.getSegment | test | public function getSegment($index)
{
$result = $this->getSegments();
return isset($result[$index]) ? $result[$index] : null;
} | php | {
"resource": ""
} |
q263829 | URI.getQueryValue | test | public function getQueryValue($key)
{
return isset($this->query[$key]) ? $this->query[$key] : null;
} | php | {
"resource": ""
} |
q263830 | Builder._build | test | protected function _build($tokens, $space) {
$output = '';
$lastToken = false;
$level = 0;
foreach ($tokens as $token) {
switch ($token['token']) {
case 'code':
$output .= $space . $token['code'] . $this->newline;
break... | php | {
"resource": ""
} |
q263831 | TAggregatable.aggregate | test | protected static function aggregate(string $name) : array {
return array_merge(is_callable($target = [get_parent_class(static::class), 'aggregate'])
? call_user_func($target, $name) : [], Arr::cast(Arr::get(get_class_vars(static::class), $name)));
} | php | {
"resource": ""
} |
q263832 | StrategyParser.get | test | public function get($strategy)
{
if (!isset($this->strategies[$strategy])) {
throw new StrategyNotFoundException(sprintf('Strategy "%s" not found in the configurations set', $strategy));
}
return $this->buildConfiguration($strategy, $this->strategies[$strategy]);
} | php | {
"resource": ""
} |
q263833 | StrategyParser.buildConfiguration | test | protected function buildConfiguration($strategy, $strategyConfig)
{
$config = array_merge($this->callParams, array(
'path' => rtrim($this->router->generate('dcs_opauth_connect'), '/').'/',
'callback_url' => $this->router->generate('dcs_opauth_response', array(
'strate... | php | {
"resource": ""
} |
q263834 | Get.composeResult | test | private function composeResult(EAccount $acc)
{
/** define local working data */
$accId = $acc->getId();
$custId = $acc->getCustomerId();
$balance = $acc->getBalance();
$typeId = $acc->getAssetTypeId();
/** compose result */
$result = new AResponse();
... | php | {
"resource": ""
} |
q263835 | Get.exec | test | public function exec($request)
{
assert($request instanceof ARequest);
/** define local working data */
$typeCode = $request->getAssetTypeCode();
$typeId = $request->getAssetTypeId();
$custId = $request->getCustomerId();
$isSys = $request->getIsSystem();
/** ... | php | {
"resource": ""
} |
q263836 | Create.exec | test | public function exec($request)
{
assert($request instanceof ARequest);
$result = new AResponse();
$operationTypeId = $request->getOperationTypeId();
$operationTypeCode = $request->getOperationTypeCode();
$datePerformed = $request->getDatePerformed();
$note = $request-... | php | {
"resource": ""
} |
q263837 | Create.prepareLogIds | test | private function prepareLogIds($custId, $adminId)
{
if (!$custId && !$adminId) {
/* both are empty */
$customer = $this->sessCust->getCustomer();
if ($customer) {
$custId = $customer->getId();
}
$user = $this->sessAdmin->getUser();... | php | {
"resource": ""
} |
q263838 | Create.validateTransactions | test | private function validateTransactions($trans)
{
$result = AResponse::ERR_NO_ERROR;
foreach ($trans as $one) {
if (is_array($one)) {
$accDbt = $one[ETrans::A_DEBIT_ACC_ID];
$accCrd = $one[ETrans::A_CREDIT_ACC_ID];
} else {
... | php | {
"resource": ""
} |
q263839 | Message.setHeaders | test | private function setHeaders(array $headers)
{
$this->headerNames = [];
$this->headers = [];
foreach ($headers as $name => $value) {
$this->setHeader($name, $value);
}
return $this;
} | php | {
"resource": ""
} |
q263840 | Message.setHeader | test | protected function setHeader($name, $value)
{
if (!is_array($value)) {
$value = [$value];
}
$this->headerNames[strtolower($name)] = $name;
array_merge($this->headers[$name] = $value);
return $this;
} | php | {
"resource": ""
} |
q263841 | Message.addHeader | test | private function addHeader($name, $value)
{
if (!$this->hasHeader($name)) {
return $this->setHeader($name, $value);
}
if (!is_array($value)) {
$value = [$value];
}
foreach ($value as $element) {
$this->headers[$this->headerNames[strtolower($name)]][] = $element;
}
return $this;
} | php | {
"resource": ""
} |
q263842 | Message.removeHeader | test | private function removeHeader($name)
{
if ($this->hasHeader($name)) {
$normalized = strtolower($name);
unset($this->headers[$this->headerNames[$normalized]], $this->headerNames[$normalized]);
}
return $this;
} | php | {
"resource": ""
} |
q263843 | ClassLoader.addPrefix | test | function addPrefix(string $prefix, $paths, int $type = self::PSR4): void
{
if ($type !== static::PSR4 && $type !== static::PSR0) {
throw new \UnexpectedValueException('Invalid prefix type');
}
if ($prefix === '') {
foreach ((array) $paths as $path) {
... | php | {
"resource": ""
} |
q263844 | ClassLoader.addPrefixes | test | function addPrefixes(array $prefixes, int $type = self::PSR4): void
{
foreach ($prefixes as $prefix => $paths) {
$this->addPrefix($prefix, $paths, $type);
}
} | php | {
"resource": ""
} |
q263845 | ClassLoader.findFile | test | function findFile(string $className): ?string
{
if ($className[0] === '\\') {
$className = substr($className, 1);
}
// check class map
if (isset($this->classMap[$className])) {
return $this->classMap[$className];
}
if ($this->usePrefixes) {
... | php | {
"resource": ""
} |
q263846 | ClassLoader.findFileWithKnownSuffix | test | private function findFileWithKnownSuffix(string $pathWithoutSuffix): ?string
{
foreach ($this->fileSuffixes as $fileSuffix) {
if (is_file($filePath = $pathWithoutSuffix . $fileSuffix)) {
return $filePath;
}
}
return null;
} | php | {
"resource": ""
} |
q263847 | ApiResponse.convertObjectToArray | test | protected function convertObjectToArray($object)
{
if (method_exists($object, 'toArray')) {
return $object->toArray();
}
return json_decode(json_encode($object, true), true);
} | php | {
"resource": ""
} |
q263848 | ApiResponse.cleanArray | test | protected function cleanArray($array, $keys = null)
{
$keys = $keys ?: array_keys($array);
foreach ($keys as $key) {
if (is_array($value = Arr::get($array, $key))) {
Arr::set($array, $key, array_filter($value));
}
}
return $array;
} | php | {
"resource": ""
} |
q263849 | ApiResponse.setCode | test | public function setCode($code)
{
$this->code = (int) $code;
return $this->mergeData([static::codeKey() => $this->code]);
} | php | {
"resource": ""
} |
q263850 | ServerRequest.initUri | test | private function initUri($uri)
{
if ($uri !== null) {
return $uri;
}
$scheme = isset($this->getServerParams()['HTTPS']) ? 'https://' : 'http://';
$host = isset($this->getServerParams()['HTTP_HOST']) ? $scheme . $this->getServerParams()['HTTP_HOST'] : '';
$path = isset($this->getServerParams()['REQUEST_UR... | php | {
"resource": ""
} |
q263851 | ServerRequest.initQueryParams | test | private function initQueryParams($serverParams)
{
$result = [];
if (isset($serverParams['REQUEST_URI']) && ($query = parse_url($serverParams['REQUEST_URI'], \PHP_URL_QUERY))) {
parse_str($query, $result);
}
return $result ?? [];
} | php | {
"resource": ""
} |
q263852 | ServerRequest.initUploadedFiles | test | private function initUploadedFiles(array $files)
{
$result = [];
foreach ($files as $key => $value) {
$result[$key] = $this->parseUploadedFiles($value);
}
return $result;
} | php | {
"resource": ""
} |
q263853 | ServerRequest.parseUploadedFiles | test | private function parseUploadedFiles($files)
{
// Empty
$first = reset($files);
// Single
if (!is_array($first)) {
return $this->parseSingleUploadedFiles($files);
}
// Multiple
if (count(array_filter(array_keys($first), 'is_string')) === 0) {
return $this->parseMultipleUploadedFiles($files);
}
... | php | {
"resource": ""
} |
q263854 | ServerRequest.parseMultipleUploadedFiles | test | private function parseMultipleUploadedFiles(array $files)
{
$count = count($files['name']);
$result = [];
for ($i = 0; $i < $count; $i++) {
$result[] = new UploadedFile($files['name'][$i], $files['type'][$i], $files['tmp_name'][$i], $files['error'][$i], $files['size'][$i]);
}
return $result;
} | php | {
"resource": ""
} |
q263855 | ServerRequest.hasContentType | test | private function hasContentType($contentType)
{
foreach ($this->getHeader('Content-Type') as $key => $value) {
if (substr($value, 0, strlen($contentType)) == $contentType) {
return true;
}
}
return false;
} | php | {
"resource": ""
} |
q263856 | CreateFiles.run | test | public function run()
{
//Create controller files
foreach ($this->getControllers() as $fileName => $filePath) {
$this->makeDirectory($filePath);
$this->filesystem->put($filePath, $this->compileStub($fileName));
}
//Create blades
foreach ($this->getBla... | php | {
"resource": ""
} |
q263857 | AbstractCommandController.dispatch | test | public function dispatch()
{
$arguments = $this->rawArguments;
$this->scriptPath = array_shift($arguments);
$this->command = array_shift($arguments);
$this->arguments = $this->parseArguments($arguments);
if (!$this->command) {
$this->outputError('No command given... | php | {
"resource": ""
} |
q263858 | AbstractCommandController.outputTable | test | public function outputTable($data, $delimiter = '|')
{
$output = '';
$firstRow = reset($data);
$columnWidths = [];
$columnCount = count($firstRow);
$headerRow = array_keys($firstRow);
if (!(is_integer(reset($headerRow)) && is_integer(end($headerRow)))) {
... | php | {
"resource": ""
} |
q263859 | AbstractCommandController.outputError | test | public function outputError($error)
{
$message = self::ESCAPE . self::RED;
if (is_scalar($error)) {
$message .= $error;
} else {
if (is_object($error) && $error instanceof \Exception) {
$message .= '#' . $error->getCode() . ': ' . $error->getMessage();... | php | {
"resource": ""
} |
q263860 | AbstractCommandController.helpCommand | test | public function helpCommand()
{
$availableCommands = $this->getAvailableCommands();
$longestCommandNameLength = max(
array_map(
function ($item) {
return strlen($item);
},
array_keys($availableCommands)
)
... | php | {
"resource": ""
} |
q263861 | AbstractCommandController.getAvailableCommands | test | public function getAvailableCommands()
{
$commands = [];
$classReflection = new \ReflectionClass(get_class($this));
$methods = $classReflection->getMethods(\ReflectionMethod::IS_PUBLIC);
/** @var \ReflectionMethod $method */
foreach ($methods as $method) {
$method... | php | {
"resource": ""
} |
q263862 | FilesInteractions.makeDirectory | test | protected function makeDirectory($path)
{
if (!$this->filesystem->isDirectory(dirname($path))) {
$this->filesystem->makeDirectory(dirname($path), 0777, true, true);
}
} | php | {
"resource": ""
} |
q263863 | FilesInteractions.AppendTo | test | protected function AppendTo($file, $stub)
{
return $this->filesystem->append(base_path() . '/routes/' . $file . '.php', $this->compileStub($stub));
} | php | {
"resource": ""
} |
q263864 | FilesInteractions.replaceAndSave | test | public function replaceAndSave($oldFile, $search, $replace, $newFile = null)
{
if (!isset($newFile) || $newFile == null) {
$newFile = $oldFile;
}
$file = $this->filesystem->get($oldFile);
$replacing = str_replace($search, $replace, $file);
$this->filesystem->put($... | php | {
"resource": ""
} |
q263865 | Dispatcher.dispatch | test | public function dispatch($uri, $method = 'GET', $arguments = [])
{
$this->originalUri = $uri;
$this->uri = $this->prepareUri($uri);
$methods = [
'GET',
'HEAD',
'POST',
'PUT',
'DELETE',
'TRACE',
'OPTIONS',
... | php | {
"resource": ""
} |
q263866 | Dispatcher.createTemplateResponse | test | public function createTemplateResponse($response)
{
$page = $this->getPage();
$view = new View();
$view->setContext($this);
$view->setTemplatePath($this->getTemplatePath());
$configuration = ConfigurationManager::getConfiguration();
$view->assignMultiple(
... | php | {
"resource": ""
} |
q263867 | Dispatcher.getPage | test | public function getPage()
{
if (!$this->page) {
$this->page = $this->getPageForUri($this->uri);
}
return $this->page;
} | php | {
"resource": ""
} |
q263868 | Dispatcher.getResponse | test | public function getResponse()
{
$statusCode = 200;
$page = $this->getPage();
if (!$page) {
$statusCode = 404;
$page = $this->getNotFoundPage();
}
return new Response(
$page ? $page->getContent() : 'Not found',
$statusCode
... | php | {
"resource": ""
} |
q263869 | Dispatcher.buildResponseForUri | test | public function buildResponseForUri($uri)
{
$page = $this->getPageForUri($uri);
if (!$page) {
return null;
}
return new Response($page->getContent());
} | php | {
"resource": ""
} |
q263870 | Dispatcher.getPageForUri | test | public function getPageForUri($uri)
{
$pageIdentifier = trim(urldecode($uri), '/');
$pageRepository = new PageRepository();
return $pageRepository->findByIdentifier($pageIdentifier);
} | php | {
"resource": ""
} |
q263871 | Dispatcher.getAliasForUri | test | public function getAliasForUri($uri)
{
$routingConfiguration = ConfigurationManager::getConfiguration()->get('routing');
$aliasConfiguration = isset($routingConfiguration['alias']) ? $routingConfiguration['alias'] : [];
return isset($aliasConfiguration[$uri]) ? $aliasConfiguration[$uri] : $... | php | {
"resource": ""
} |
q263872 | I18nMessageController.actionView | test | public function actionView($id)
{
if(Yii::$app->request->isAjax)
return $this->renderAjax('view', [
'model' => $this->findModel($id),
]);
else
return $this->render('view', [
'model' => $this->findModel($id),
]);
} | php | {
"resource": ""
} |
q263873 | I18nMessageController.actionCreate | test | public function actionCreate()
{
$model = new I18nMessage();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
if(Yii::$app->request->isAjax)
return $this->redirect(['index']);
else
return $this->redirect(['view', 'id' => $mode... | php | {
"resource": ""
} |
q263874 | AnchorTrait.addHeadlineIds | test | public function addHeadlineIds($content)
{
$regex = '/\<h([0-6]{1})\>(.+)\<\/h[0-6]{1}\>/';
return preg_replace_callback(
$regex,
function ($matches) {
$headlineLevel = $matches[1];
$headlineText = $matches[2];
return sprintf(... | php | {
"resource": ""
} |
q263875 | Bootstrap.run | test | public function run()
{
Dispatcher::getSharedDispatcher()->dispatch($this->getUri(), $this->getMethod(), $this->getArguments());
} | php | {
"resource": ""
} |
q263876 | Bootstrap.runCli | test | public function runCli($arguments)
{
$commandController = new \Cundd\Noshi\Command\NoshiCommandController($arguments);
$commandController->dispatch();
} | php | {
"resource": ""
} |
q263877 | AuthEmailServiceProvider.register | test | public function register()
{
/*
* Bind interfaces to concrete implementations
*/
$this->app->bind(
ActivationInterface::class,
Activation::class
);
$this->app->bind(
Email::class,
EmailAdapter::class
);
... | php | {
"resource": ""
} |
q263878 | MarkdownFactory.getMarkdownRenderer | test | static public function getMarkdownRenderer()
{
if (!self::$markdownRendererInstance) {
if (class_exists('\\Michelf\\Markdown')) {
self::$markdownRendererInstance = new MichelfRenderer();
} else {
self::$markdownRendererInstance = new ParsedownRenderer(... | php | {
"resource": ""
} |
q263879 | Files.getBlades | test | protected function getBlades()
{
$path = base_path() . '/resources/views/';
$loginStub = $this->laravelVersion >= 5.6 ? 'login.blade.b4' : 'login.blade';
$files = [
$loginStub => $path . 'auth/login.blade.php',
'auth.email' => $path . 'emails/auth.blade.php',
... | php | {
"resource": ""
} |
q263880 | Files.getMigrations | test | protected function getMigrations()
{
$formatted_date = date('Y_m_d_His');
$path = base_path() . '/database/migrations/';
$files = [
'MigrationActivations' => $path . $formatted_date . '_create_user_activations_table.php',
'MigrationUsers' => $path . $formatted_date . ... | php | {
"resource": ""
} |
q263881 | PageRepository.findByIdentifier | test | public function findByIdentifier($identifier)
{
if (isset($this->allPages[$identifier])) {
return $this->allPages[$identifier];
}
$rawPageData = null;
$configuration = ConfigurationManager::getConfiguration();
$dataPath = $configuration->get('basePath') . $config... | php | {
"resource": ""
} |
q263882 | PageRepository.getPageNameForPageIdentifier | test | public function getPageNameForPageIdentifier($identifier)
{
$pageName = urldecode($identifier);
if (!$pageName || $pageName[0] === '.' || strpos($pageName, '/.') !== false) {
throw new InvalidPageIdentifierException('Invalid page identifier');
}
if ($pageName[0] === '/'... | php | {
"resource": ""
} |
q263883 | PageRepository.buildMetaDataForPageIdentifier | test | public function buildMetaDataForPageIdentifier($identifier, $pageDataPath = null)
{
$configuration = ConfigurationManager::getConfiguration();
$dataPath = $configuration->get('basePath') . $configuration->get('dataPath');
$pageName = $this->getPageNameForPageIdentifier($identifier);
... | php | {
"resource": ""
} |
q263884 | PageRepository.getPageTree | test | public function getPageTree()
{
if (!$this->pageTree) {
$configuration = ConfigurationManager::getConfiguration();
$dataPath = $configuration->get('basePath') . $configuration->get('dataPath');
$this->pageTree = $this->getPagesForPath($dataPath);
}
return... | php | {
"resource": ""
} |
q263885 | PageRepository.getPagesForPath | test | public function getPagesForPath($path, $uriBase = '')
{
$pages = [];
$pagesSortingMap = [];
$pagesIdentifierMap = [];
if (!file_exists($path)) {
throw new \InvalidArgumentException("Page path '$path' does not exist");
}
if (!is_readable($path)) {
... | php | {
"resource": ""
} |
q263886 | AuthEmail.Success | test | private function Success()
{
$migrated = '';
if ($this->option('migrate')) {
$migrated = ' and migrated database';
}
$this->info('Email authentication generated successfully' . $migrated . '.');
$this->composer->dumpAutoloads();
} | php | {
"resource": ""
} |
q263887 | I18nMessage.loadMessagesFromDb | test | public static function loadMessagesFromDb($category, $language)
{
$mainQuery = new Query();
$mainQuery->select(['t1.message', 't2.translation'])
->from([I18nMessage::tableName().' t1', I18nTranslation::tableName().' t2'])
->where('t1.message_id = t2.message_id AND t1.cat... | php | {
"resource": ""
} |
q263888 | EmailService.sendActivationMail | test | public function sendActivationMail($user)
{
if ($user->activated || !$this->shouldSend($user)) {
return;
}
$token = $this->activationRepo->createActivation($user);
$link = route('user.activate', $token);
$this->mailer->sendTo($user, $link);
} | php | {
"resource": ""
} |
q263889 | Fuzzy.search | test | public function search(array $rows, $query, $threshold = 3)
{
$matched = [];
foreach($rows as $row)
{
$distance = $this->calculateDistance($query, $row);
if ($threshold >= $distance)
{
$matched[] = [$distance, $row];
}
... | php | {
"resource": ""
} |
q263890 | Template.render | test | public function render()
{
$template = $this->getTemplate();
// Find the expressions
$matches = [];
if (!preg_match_all('!\{([\w\.\\\ \/]*)\}!', $template, $matches)) {
return $template;
}
$expressions = $matches[1];
$expressions = array_unique($... | php | {
"resource": ""
} |
q263891 | Template.renderExpression | test | public function renderExpression($expression)
{
if (strpos($expression, '\\') !== false) {
$expressionParts = explode(' ', $expression);
$viewClass = '\\' . array_shift($expressionParts);
/** @var UiInterface $newView */
if (!class_exists($viewClass)) {
... | php | {
"resource": ""
} |
q263892 | Template.resolveExpressionKeyPath | test | public function resolveExpressionKeyPath($keyPath)
{
if (isset($this->data[$keyPath])) {
return $this->data[$keyPath];
}
return ObjectUtility::valueForKeyPathOfObject($keyPath, $this->data);
} | php | {
"resource": ""
} |
q263893 | BundleClassFinder.findClasses | test | public function findClasses($subDir = null, $suffix = null, $parent = null, $reflection = false)
{
$classes = [];
foreach ($this->bundles as $bundle) {
$this->setRootDirectory($bundle->getPath());
$this->setRootNamespace($bundle->getNamespace());
$classes = array_... | php | {
"resource": ""
} |
q263894 | Configuration.prepareConfigurationArray | test | private function prepareConfigurationArray(array $configuration)
{
$pathConfiguration = [
'dataPath',
'templatePath',
'resourcePath',
];
foreach ($pathConfiguration as $key) {
if (isset($configuration[$key])) {
$configuration[$k... | php | {
"resource": ""
} |
q263895 | Configuration.getHost | test | public function getHost()
{
$host = '';
if (isset($_SERVER['SERVER_NAME']) && $_SERVER['SERVER_NAME'] !== '0.0.0.0') {
$host = $_SERVER['SERVER_NAME'];
if (!$this->_validateHost($host)) {
$host = '';
}
// Add the port
if (... | php | {
"resource": ""
} |
q263896 | Configuration.get | test | public function get($key)
{
$accessorMethod = 'get' . ucfirst($key);
if (method_exists($this, $accessorMethod)) {
return $this->$accessorMethod();
}
return $this->_get($key);
} | php | {
"resource": ""
} |
q263897 | I18nTranslationController.actionView | test | public function actionView($message_id, $language)
{
if(Yii::$app->request->isAjax)
return $this->renderAjax('view', [
'model' => $this->findModel($message_id, $language),
]);
else
return $this->render('view', [
'model' => $this->fi... | php | {
"resource": ""
} |
q263898 | I18nTranslationController.actionUpdate | test | public function actionUpdate($message_id, $language)
{
$model = $this->findModel($message_id, $language);
if ($model->load(Yii::$app->request->post()) && $model->save()) {
if(Yii::$app->request->isAjax)
return $this->redirect(['index']);
else
... | php | {
"resource": ""
} |
q263899 | I18nTranslationController.actionDelete | test | public function actionDelete($message_id, $language)
{
$this->findModel($message_id, $language)->delete();
return $this->redirect(['index']);
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.