_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q266000 | Table.getPrimaryKeys | test | public function getPrimaryKeys()
{
if ($this->primary_keys === null) {
try {
$this->primary_keys = $this->tableManager->metadata()->getPrimaryKeys($this->prefixed_table);
} catch (\Soluble\Schema\Exception\NoPrimaryKeyException $e) {
throw new Exceptio... | php | {
"resource": ""
} |
q266001 | Table.getPrimaryKey | test | public function getPrimaryKey()
{
if ($this->primary_key === null) {
$pks = $this->getPrimaryKeys();
if (count($pks) > 1) {
throw new Exception\MultiplePrimaryKeysFoundException(__METHOD__ . ": Error getting unique primary key on table, multiple found on table " . $th... | php | {
"resource": ""
} |
q266002 | Table.getColumnsInformation | test | public function getColumnsInformation()
{
if ($this->column_information === null) {
$this->column_information = $this->tableManager
->metadata()
->getColumnsInformation($this->prefixed_table);
}
return $this->column_information;
} | php | {
"resource": ""
} |
q266003 | Table.executeStatement | test | protected function executeStatement($sqlObject)
{
if ($sqlObject instanceof PreparableSqlInterface) {
$statement = $this->sql->prepareStatementForSqlObject($sqlObject);
} elseif (is_string($sqlObject)) {
$statement = $this->tableManager->getDbAdapter()->createStatement($sqlOb... | php | {
"resource": ""
} |
q266004 | Table.getPrimaryKeyPredicate | test | protected function getPrimaryKeyPredicate($id)
{
if (!is_scalar($id) && !is_array($id)) {
throw new Exception\InvalidArgumentException(__METHOD__ . ": Id must be scalar or array, type " . gettype($id) . " received");
}
$keys = $this->getPrimaryKeys();
if (count($keys) == ... | php | {
"resource": ""
} |
q266005 | Table.checkDataColumns | test | protected function checkDataColumns(array $data)
{
$diff = array_diff_key($data, $this->getColumnsInformation());
if (count($diff) > 0) {
$msg = implode(',', array_keys($diff));
throw new Exception\ColumnNotFoundException(__METHOD__ . ": some specified columns '$msg' does not... | php | {
"resource": ""
} |
q266006 | Api.parseAsArray | test | protected function parseAsArray($content)
{
$data = json_decode($content, true);
return array(
isset($data['status']) ? $data['status'] : false,
isset($data['error']) ? $data['error'] : false,
$data,
);
} | php | {
"resource": ""
} |
q266007 | Api.parseAsObject | test | protected function parseAsObject($content)
{
$data = json_decode($content);
return array(
property_exists($data, 'status') ? $data->status : false,
property_exists($data, 'error') ? $data->error : false,
$data
);
} | php | {
"resource": ""
} |
q266008 | Api.setReturnType | test | public function setReturnType($returnType)
{
if (!in_array($returnType, array(static::RETURN_OBJECT, static::RETURN_ARRAY))) {
throw new InvalidArgumentException(sprintf('Invalid return type "%s" given.', $returnType));
}
$this->returnType = $returnType;
return $this;
... | php | {
"resource": ""
} |
q266009 | Loader.run | test | public function run()
{
// Enqueue styles and scripts
$this->action('wp_enqueue_scripts', $this->enqueue('wp'));
$this->action('admin_enqueue_scripts', $this->enqueue('admin'));
foreach ($this->filters as $hook) {
add_filter($hook['hook'], $hook['callback'], $hook['prior... | php | {
"resource": ""
} |
q266010 | Loader.enqueue | test | protected function enqueue($type)
{
$filter = function ($val) use ($type) {
return in_array($val['type'], array($type, 'both'));
};
return function () use ($filter) {
foreach (array_filter($this->styles, $filter) as $hook) {
wp_enqueue_style($hook['ha... | php | {
"resource": ""
} |
q266011 | MoveBuilder.is | test | public function is($type)
{
if (null !== $this->type) {
throw new LogicException('Already typed');
}
$this->type = $type;
return $this;
} | php | {
"resource": ""
} |
q266012 | MoveBuilder.named | test | public function named($name)
{
if (null !== $this->name) {
throw new LogicException('Already named');
}
$this->name = $name;
return $this;
} | php | {
"resource": ""
} |
q266013 | MoveBuilder.start | test | public function start($position)
{
if (null !== $this->initialPosition) {
throw new LogicException('Start already defined');
}
$this->initialPosition = $position;
return $this;
} | php | {
"resource": ""
} |
q266014 | MoveBuilder.deal | test | public function deal($damage)
{
if (null !== $this->damage) {
throw new LogicException('Damage already defined');
}
$this->damage = $damage;
return $this;
} | php | {
"resource": ""
} |
q266015 | MoveBuilder.aim | test | public function aim($hitLevel)
{
if (null !== $this->hitLevel) {
throw new LogicException('Hit level already defined');
}
$this->hitLevel = $hitLevel;
return $this;
} | php | {
"resource": ""
} |
q266016 | MoveBuilder.withMeterGain | test | public function withMeterGain($value)
{
if (null !== $this->meterGain) {
throw new LogicException('Meter gain already defined');
}
$this->meterGain = $value;
return $this;
} | php | {
"resource": ""
} |
q266017 | MoveBuilder.withInputs | test | public function withInputs($inputs)
{
if (0 < count($this->inputs)) {
throw new LogicException('Inputs already defined');
}
$this->inputs = $this->parser->transforms($inputs);
return $this;
} | php | {
"resource": ""
} |
q266018 | MoveBuilder.addCancel | test | public function addCancel(MoveInterface $move)
{
foreach ($this->cancelAbilities as $cancelAbility) {
if ($cancelAbility->equals($move)) {
throw new LogicException(
sprintf('Cancel ability "%s" already defined', $move->getName())
);
... | php | {
"resource": ""
} |
q266019 | MoveBuilder.startIn | test | public function startIn($frames)
{
if (null !== $this->startFrames) {
throw new LogicException('Start frames already defined');
}
$this->startFrames = $frames;
return $this;
} | php | {
"resource": ""
} |
q266020 | MoveBuilder.activeDuring | test | public function activeDuring($frames)
{
if (null !== $this->activeFrames) {
throw new LogicException('Active frames already defined');
}
$this->activeFrames = $frames;
return $this;
} | php | {
"resource": ""
} |
q266021 | MoveBuilder.recoverIn | test | public function recoverIn($frames)
{
if (null !== $this->recoveryFrames) {
throw new LogicException('Recovery frames already defined');
}
$this->recoveryFrames = $frames;
return $this;
} | php | {
"resource": ""
} |
q266022 | MoveBuilder.advantageOnHit | test | public function advantageOnHit($frames)
{
if (null !== $this->hitAdvantage) {
throw new LogicException('Hit advantage already defined');
}
$this->hitAdvantage = $frames;
return $this;
} | php | {
"resource": ""
} |
q266023 | MoveBuilder.advantageOnGuard | test | public function advantageOnGuard($frames)
{
if (null !== $this->guardAdvantage) {
throw new LogicException('Guard advantage already defined');
}
$this->guardAdvantage = $frames;
return $this;
} | php | {
"resource": ""
} |
q266024 | MoveBuilder.build | test | public function build()
{
return new Move(
$this->type,
$this->name,
$this->initialPosition,
$this->inputs,
$this->damage,
$this->meterGain,
$this->hitLevel,
$this->cancelAbilities,
new FrameData(
... | php | {
"resource": ""
} |
q266025 | Notify.sendSlackMessage | test | private static function sendSlackMessage($message, $channel)
{
// do not send Slack messages in test mode for now
// @todo Trap these for testing
if (Director::isTest()) {
return;
}
$hooksFromConfig = Config::inst()->get('Suilven\Notifier\Notify', 'slack_webhooks... | php | {
"resource": ""
} |
q266026 | NativePathGenerator.parse | test | public function parse(array $segments, array $data = null, array $params = null): string
{
// If data was passed but no params
if (null === $params && null !== $data) {
throw new InvalidArgumentException(
'Route params are required when supplying data'
);
... | php | {
"resource": ""
} |
q266027 | NativePathGenerator.parseData | test | protected function parseData(
array $segments,
array $data,
array $params,
array &$replace,
array &$replacements
): void {
// Iterate through all the data properties
foreach ($data as $key => $datum) {
// If the data isn't found in the params array... | php | {
"resource": ""
} |
q266028 | NativePathGenerator.validateDatum | test | protected function validateDatum(string $key, $datum, string $regex): void
{
if (\is_array($datum)) {
foreach ($datum as $datumItem) {
$this->validateDatum($key, $datumItem, $regex);
}
return;
}
// If the value of the data doesn't match w... | php | {
"resource": ""
} |
q266029 | NativePathGenerator.findParamSegment | test | protected function findParamSegment(array $segments, string $param): ? string
{
$segment = null;
foreach ($segments as $segment) {
if (strpos($segment, $param) !== false) {
return $segment;
}
}
return $segment;
} | php | {
"resource": ""
} |
q266030 | ResourceGeneratorCommand.callRepository | test | protected function callRepository($resource)
{
$repositoryName = $this->getRepositoryName($resource);
if ($this->confirm("Do you want me to create a $repositoryName Repository? [yes|no]"))
{
$this->call('generate:repository', compact('repositoryName'));
}
} | php | {
"resource": ""
} |
q266031 | ClassName.validate | test | private function validate($name): void {
try {
new ReflectionClass($name);
} catch(ReflectionException $ex) {
throw new InvalidArgumentException('Expected class name, but got [' . var_export($name, true) . '] instead');
}
} | php | {
"resource": ""
} |
q266032 | ImageModel.isImage | test | public function isImage( $exif=null )
{
$_ext = empty($exif) ? self::$img_extensions : self::$exif_extensions;
$tbl = explode('.', $this->filename);
$last = end($tbl);
return (bool) ($this->pathExists() && $this->exists() && in_array(strtolower($last), $_ext));
} | php | {
"resource": ""
} |
q266033 | ImageModel.count | test | public function count()
{
$_new_dir = new DirectoryModel;
$_new_dir->setPath( dirname($this->getPath()) );
$_new_dir->setDirname( basename($this->getPath()) );
return count($_new_dir->scanDir());
} | php | {
"resource": ""
} |
q266034 | RequestHelper.getConsolePathInfo | test | protected function getConsolePathInfo() {
if (!isset($this->_route)) {
$data = $this->getConsoleRouteAndParams();
$this->_route = (string)$data[0];
}
return $this->_route;
} | php | {
"resource": ""
} |
q266035 | RequestHelper.getConsoleRouteAndParamsRaw | test | protected function getConsoleRouteAndParamsRaw()
{
$rawParams = $this->getConsoleParamsRaw();
$endOfOptionsFound = false;
if (isset($rawParams[0])) {
$route = array_shift($rawParams);
if ($route === '--') {
$endOfOptionsFound = true;
$... | php | {
"resource": ""
} |
q266036 | Uri.withScheme | test | public function withScheme($scheme): UriInterface
{
if (!in_array(strtolower($scheme), ['', 'http', 'https'])) {
throw new InvalidArgumentException('Scheme must be one of : "", "http" or "https"');
}
$uri = clone $this;
$uri->scheme = $scheme;
return $uri;
} | php | {
"resource": ""
} |
q266037 | Uri.withUserInfo | test | public function withUserInfo($user, $password = null)
{
$uri = clone $this;
$uri->user = $user;
$uri->password = $password ?: '';
return $uri;
} | php | {
"resource": ""
} |
q266038 | Uri.withHost | test | public function withHost($host)
{
if (false) {
// Invalid hostname ?
throw new InvalidArgumentException('Hostname is not valid.');
}
$uri = clone $this;
$uri->host = $host;
return $uri;
} | php | {
"resource": ""
} |
q266039 | Uri.withPort | test | public function withPort($port = null)
{
if ($port !== null && $port < 1 && $port > 65535) {
throw new InvalidArgumentException(
'Port must be null or an integer between 1 and 65535'
);
}
$uri = clone $this;
$uri->port = $port;
return... | php | {
"resource": ""
} |
q266040 | Net_URL2._queryArrayByKey | test | private function _queryArrayByKey($key, $value, array $array = array())
{
if (!strlen($key)) {
return $array;
}
$offset = $this->_queryKeyBracketOffset($key);
if ($offset === false) {
$name = $key;
} else {
$name = substr($key, 0, $offset)... | php | {
"resource": ""
} |
q266041 | Net_URL2._queryArrayByBrackets | test | private function _queryArrayByBrackets($buffer, $value, array $array = null)
{
$entry = &$array;
for ($iteration = 0; strlen($buffer); $iteration++) {
$open = $this->_queryKeyBracketOffset($buffer);
if ($open !== 0) {
// Opening bracket [ must exist at offset... | php | {
"resource": ""
} |
q266042 | Net_URL2.setQueryVariables | test | public function setQueryVariables(array $array)
{
if (!$array) {
$this->_query = false;
} else {
$this->_query = $this->buildQuery(
$array,
$this->getOption(self::OPTION_SEPARATOR_OUTPUT)
);
}
return $this;
} | php | {
"resource": ""
} |
q266043 | Net_URL2.setQueryVariable | test | public function setQueryVariable($name, $value)
{
$array = $this->getQueryVariables();
$array[$name] = $value;
$this->setQueryVariables($array);
return $this;
} | php | {
"resource": ""
} |
q266044 | Net_URL2.getURL | test | public function getURL()
{
// See RFC 3986, section 5.3
$url = '';
if ($this->_scheme !== false) {
$url .= $this->_scheme . ':';
}
$url .= $this->_buildAuthorityAndPath($this->getAuthority(), $this->_path);
if ($this->_query !== false) {
$ur... | php | {
"resource": ""
} |
q266045 | Net_URL2.normalize | test | public function normalize()
{
// See RFC 3986, section 6
// Scheme is case-insensitive
if ($this->_scheme) {
$this->_scheme = strtolower($this->_scheme);
}
// Hostname is case-insensitive
if ($this->_host) {
$this->_host = strtolower($this->_... | php | {
"resource": ""
} |
q266046 | Net_URL2.resolve | test | public function resolve($reference)
{
if (!$reference instanceof Net_URL2) {
$reference = new self($reference);
}
if (!$reference->_isFragmentOnly() && !$this->isAbsolute()) {
throw new Exception(
'Base-URL must be absolute if reference is not fragment... | php | {
"resource": ""
} |
q266047 | Net_URL2._isFragmentOnly | test | private function _isFragmentOnly()
{
return (
$this->_fragment !== false
&& $this->_query === false
&& $this->_path === ''
&& $this->_port === false
&& $this->_host === false
&& $this->_userinfo === false
&& $this->_scheme =... | php | {
"resource": ""
} |
q266048 | Net_URL2.getCanonical | test | public static function getCanonical()
{
if (!isset($_SERVER['REQUEST_METHOD'])) {
// ALERT - no current URL
throw new Exception('Script was not called through a webserver');
}
// Begin with a relative URL
$url = new self($_SERVER['PHP_SELF']);
$url->_... | php | {
"resource": ""
} |
q266049 | Net_URL2.getRequested | test | public static function getRequested()
{
if (!isset($_SERVER['REQUEST_METHOD'])) {
// ALERT - no current URL
throw new Exception('Script was not called through a webserver');
}
// Begin with a relative URL
$url = new self($_SERVER['REQUEST_URI']);
$url... | php | {
"resource": ""
} |
q266050 | Net_URL2.getOption | test | public function getOption($optionName)
{
return isset($this->_options[$optionName])
? $this->_options[$optionName] : false;
} | php | {
"resource": ""
} |
q266051 | Net_URL2.buildQuery | test | protected function buildQuery(array $data, $separator, $key = null)
{
$query = array();
foreach ($data as $name => $value) {
if ($this->getOption(self::OPTION_ENCODE_KEYS) === true) {
$name = rawurlencode($name);
}
if ($key !== null) {
... | php | {
"resource": ""
} |
q266052 | Net_URL2.parseUrl | test | protected function parseUrl($url)
{
// The regular expression is copied verbatim from RFC 3986, appendix B.
// The expression does not validate the URL but matches any string.
preg_match(
'(^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?)',
$url, $matches
... | php | {
"resource": ""
} |
q266053 | Trace.display | test | public final function display(string $text, int $tab = 0, string $highlighter = "*") {
$_tab = null;
for ($index = 0; $index < $tab; $index++) {
$_tab .= $this->tabSpace;
}
echo("(" . Date("Y-m-d H:i:s") . ") | {$_tab}{$highlighter} {$text}" . PHP_EOL);
return null;
} | php | {
"resource": ""
} |
q266054 | TranslationPromise.translate | test | public function translate($language = null)
{
if (isset($language)) {
$this->language = $language;
} else {
$this->suggestLanguage();
}
return Reaction::t($this->category, $this->message, $this->params, $this->language);
} | php | {
"resource": ""
} |
q266055 | TranslationPromise.suggestLanguage | test | protected function suggestLanguage()
{
if (Reaction::isDebug()) {
Reaction::warning(__METHOD__ . ' call. Avoid it for performance reasons.');
}
$trace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS);
$traceCount = count($trace) - 1;
... | php | {
"resource": ""
} |
q266056 | AutomatedTrait.getNewStateList | test | private function getNewStateList(): array
{
$statesList = [];
foreach ($this->getStatesAssertions() as $stateAssertion) {
if ($stateAssertion->isValid($this)) {
$statesList = \array_merge(
$statesList,
\array_flip($stateAssertion->... | php | {
"resource": ""
} |
q266057 | AutomatedTrait.filterStatesNames | test | private function filterStatesNames(array &$newStateList): AutomatedInterface
{
foreach ($newStateList as &$stateName) {
$this->validateName($stateName);
}
return $this;
} | php | {
"resource": ""
} |
q266058 | AutomatedTrait.switchToNewStates | test | private function switchToNewStates(array $newStateList): AutomatedInterface
{
$this->filterStatesNames($newStateList);
$lastEnabledStates = $this->listEnabledStates();
$outgoingStates = \array_diff($lastEnabledStates, $newStateList);
foreach ($outgoingStates as $stateName) {
... | php | {
"resource": ""
} |
q266059 | BudgetCategoryMapper.findAllByBudgetId | test | public function findAllByBudgetId($budgetId)
{
$budgetId = (int) $budgetId;
$this->addWhere('budget_id', $budgetId);
$list = $this->select();
$collection = array();
foreach ($list as $item) {
$collection[$item->getCategoryId()] = $item;
}
return... | php | {
"resource": ""
} |
q266060 | SecurityController.actionLogin | test | public function actionLogin() {
if (!Yii::$app->user->isGuest) {
$this->goHome();
}
/** @var LoginForm $model */
$model = Yii::createObject(LoginForm::className());
$event = $this->getFormEvent($model);
$this->performAjaxValidation($model);
$this->tri... | php | {
"resource": ""
} |
q266061 | SecurityController.actionLogout | test | public function actionLogout() {
$event = $this->getUserEvent(Yii::$app->user->identity);
$this->trigger(self::EVENT_BEFORE_LOGOUT, $event);
Yii::$app->getUser()->logout();
$this->trigger(self::EVENT_AFTER_LOGOUT, $event);
return $this->goHome();
} | php | {
"resource": ""
} |
q266062 | SecurityController.connect | test | public function connect(ClientInterface $client) {
/** @var Account $account */
$account = Yii::createObject(Account::className());
$event = $this->getAuthEvent($account, $client);
$this->trigger(self::EVENT_BEFORE_CONNECT, $event);
$account->connectWithUser($client);
$th... | php | {
"resource": ""
} |
q266063 | Mail_mime.getParam | test | function getParam($name)
{
return isset($this->_build_params[$name]) ? $this->_build_params[$name] : null;
} | php | {
"resource": ""
} |
q266064 | Mail_mime.setHTMLBody | test | function setHTMLBody($data, $isfile = false)
{
if (!$isfile) {
$this->_htmlbody = $data;
} else {
$cont = $this->_file2str($data);
if ($this->_isError($cont)) {
return $cont;
}
$this->_htmlbody = $cont;
}
re... | php | {
"resource": ""
} |
q266065 | Mail_mime.addHTMLImage | test | function addHTMLImage($file,
$c_type='application/octet-stream',
$name = '',
$isfile = true,
$content_id = null
) {
$bodyfile = null;
if ($isfile) {
// Don't load file into memory
if ($this->_build_params['delay_file_io']) {
$f... | php | {
"resource": ""
} |
q266066 | Mail_mime.addAttachment | test | function addAttachment($file,
$c_type = 'application/octet-stream',
$name = '',
$isfile = true,
$encoding = 'base64',
$disposition = 'attachment',
$charset = '',
$language = '',
$location = '',
$n_encoding = null,
... | php | {
"resource": ""
} |
q266067 | Mail_mime._file2str | test | function _file2str($file_name)
{
// Check state of file and raise an error properly
if (!file_exists($file_name)) {
return $this->_raiseError('File not found: ' . $file_name);
}
if (!is_file($file_name)) {
return $this->_raiseError('Not a regular file: ' . $fi... | php | {
"resource": ""
} |
q266068 | Mail_mime.& | test | function &_addTextPart(&$obj = null, $text = '')
{
$params['content_type'] = 'text/plain';
$params['encoding'] = $this->_build_params['text_encoding'];
$params['charset'] = $this->_build_params['text_charset'];
$params['eol'] = $this->_build_params['eol'];
... | php | {
"resource": ""
} |
q266069 | Mail_mime.& | test | function &_addHtmlPart(&$obj = null)
{
$params['content_type'] = 'text/html';
$params['encoding'] = $this->_build_params['html_encoding'];
$params['charset'] = $this->_build_params['html_charset'];
$params['eol'] = $this->_build_params['eol'];
if (is_object... | php | {
"resource": ""
} |
q266070 | Mail_mime.& | test | function &_addHtmlImagePart(&$obj, $value)
{
$params['content_type'] = $value['c_type'];
$params['encoding'] = 'base64';
$params['disposition'] = 'inline';
$params['filename'] = $value['name'];
$params['cid'] = $value['cid'];
$params['body_file'] ... | php | {
"resource": ""
} |
q266071 | Mail_mime.& | test | function &_addAttachmentPart(&$obj, $value)
{
$params['eol'] = $this->_build_params['eol'];
$params['filename'] = $value['name'];
$params['encoding'] = $value['encoding'];
$params['content_type'] = $value['c_type'];
$params['body_file'] = $value['body_file... | php | {
"resource": ""
} |
q266072 | Mail_mime._encodeHeaders | test | function _encodeHeaders($input, $params = array())
{
$build_params = $this->_build_params;
while (list($key, $value) = each($params)) {
$build_params[$key] = $value;
}
foreach ($input as $hdr_name => $hdr_value) {
if (is_array($hdr_value)) {
f... | php | {
"resource": ""
} |
q266073 | Mail_mime._checkParams | test | function _checkParams()
{
$encodings = array('7bit', '8bit', 'base64', 'quoted-printable');
$this->_build_params['text_encoding']
= strtolower($this->_build_params['text_encoding']);
$this->_build_params['html_encoding']
= strtolower($this->_build_params['html_encodi... | php | {
"resource": ""
} |
q266074 | Validator.check | test | public function check($value)
{
if ($this->hasError($value)) {
$this->error = sprintf($this->errorTpl, (string) $value);
return false;
}
return true;
} | php | {
"resource": ""
} |
q266075 | PhpManager.init | test | public function init()
{
parent::init();
$this->itemFile = Reaction::$app->getAlias($this->itemFile);
$this->assignmentFile = Reaction::$app->getAlias($this->assignmentFile);
$this->ruleFile = Reaction::$app->getAlias($this->ruleFile);
$this->load();
} | php | {
"resource": ""
} |
q266076 | PhpManager.load | test | protected function load()
{
$this->children = [];
$this->rules = [];
$this->assignments = [];
$this->items = [];
$items = $this->loadFromFile($this->itemFile);
$itemsMtime = @filemtime($this->itemFile);
$assignments = $this->loadFromFile($this->assignmentFile... | php | {
"resource": ""
} |
q266077 | PhpManager.save | test | protected function save()
{
$promises = [
$this->saveItems(),
$this->saveAssignments(),
$this->saveRules(),
];
return all($promises);
} | php | {
"resource": ""
} |
q266078 | PhpManager.saveToFile | test | protected function saveToFile($data, $filePath)
{
$fileContent = "<?php\nreturn " . VarDumper::export($data) . ";\n";
$self = $this;
return Reaction\Helpers\FileHelperAsc::putContents($filePath, $fileContent, 'cwt')->then(
function() use ($self, $filePath) {
$self... | php | {
"resource": ""
} |
q266079 | NativeJsonResponse.createJson | test | public static function createJson(
string $content = '',
int $status = StatusCode::OK,
array $headers = [],
array $data = []
): JsonResponse {
return new static($content, $status, $headers, $data);
} | php | {
"resource": ""
} |
q266080 | NativeJsonResponse.setCallback | test | public function setCallback(string $callback = null): JsonResponse
{
if (null !== $callback) {
// taken from http://www.geekality.net/2011/08/03/valid-javascript-identifier/
$pattern = '/^[$_\p{L}][$_\p{L}\p{Mn}\p{Mc}\p{Nd}\p{Pc}\x{200C}\x{200D}]*+$/u';
$parts = explode... | php | {
"resource": ""
} |
q266081 | NativeJsonResponse.setEncodingOptions | test | public function setEncodingOptions(int $encodingOptions): JsonResponse
{
$this->encodingOptions = $encodingOptions;
return $this->setData(json_decode($this->data));
} | php | {
"resource": ""
} |
q266082 | Error.getLayout | test | protected function getLayout(TemplateInterface $template)
{
$layout = new Template($this->layoutPath . EKA_SEP . 'Main');
$layout->setVar('content', $template->render());
$layout->setVar('meta', Config::getInstance()->get('Eureka\Meta'));
return $layout;
} | php | {
"resource": ""
} |
q266083 | Category.getWordsAsString | test | public function getWordsAsString()
{
$words = array();
foreach ($this->getAllCategoryWord() as $word) {
$words[] = $word->getName();
}
return implode(', ', $words);
} | php | {
"resource": ""
} |
q266084 | TableGateaway.update | test | public function update($sessionEntity, $data)
{
return $this->storageManager->update(
$data,
[
$this->options->getIdColumn() => $this->getIdValue($sessionEntity),
$this->options->getNameColumn() => $this->getNameValue($sessionEntity)
]
... | php | {
"resource": ""
} |
q266085 | TableGateaway.delete | test | public function delete($sessionEntity)
{
return (bool) $this->storageManager->delete(
[
$this->options->getIdColumn() => $this->getIdValue($sessionEntity),
$this->options->getNameColumn() => $this->getNameValue($sessionEntity)
]
);
} | php | {
"resource": ""
} |
q266086 | ConfigPmTrait.configurePMOptions | test | protected function configurePMOptions(Command $command)
{
$iniMemLimit = ceil($this->getIniMemoryLimit() * 0.9);
$command
->addOption('bridge', null, InputOption::VALUE_REQUIRED, 'Bridge for converting React Psr7 requests to target framework.', 'ReactionBridge')
->addOption('... | php | {
"resource": ""
} |
q266087 | ConfigPmTrait.loadPmConfig | test | protected function loadPmConfig(InputInterface $input, OutputInterface $output)
{
$config = [];
if ($path = $this->getPmConfigPath($input)) {
$content = file_get_contents($path);
$config = json_decode($content, true);
}
$config['bridge'] = $this->optionOrCon... | php | {
"resource": ""
} |
q266088 | ConfigPmTrait.getIniMemoryLimit | test | private function getIniMemoryLimit()
{
$iniMemLimit = ini_get('memory_limit');
if (!is_numeric($iniMemLimit)) {
$iniSuffix = strtoupper(substr($iniMemLimit, -1));
$iniMemLimit = substr($iniMemLimit, 0, -1);
$iniMultiplier = 1024; //K
$iniMultiplier = $... | php | {
"resource": ""
} |
q266089 | ModelBoundLeaf.onModelCreated | test | protected function onModelCreated()
{
parent::onModelCreated();
if ($this->incomingRestModel instanceof Model){
$this->setRestModel($this->incomingRestModel);
} elseif ($this->incomingRestModel instanceof Collection){
$this->setRestCollection($this->incomingRestModel... | php | {
"resource": ""
} |
q266090 | AbstractTool.render | test | public function render()
{
$args = $this->buildViewParams();
if (isset($args['output']))
$this->output = $args['output'];
if (!empty($this->view)) {
return FrontController::getInstance()
->view( DirectoryHelper::slashDirname($this->views_dir).$this->v... | php | {
"resource": ""
} |
q266091 | Application.addPlugin | test | public function addPlugin(IPlugin $plugin, $autoExecute = false) {
if (isset($this[$plugin->getPluginName()])) {
return $this;
}
$plugin->setApplication($this);
$plugin->initPlugin();
if ($autoExecute) {
$this->{$plugin->getPluginName()};
}
... | php | {
"resource": ""
} |
q266092 | Application.config | test | public function config($key) {
$keys = explode('.', $key);
$config = func_num_args() === 1 ? $this['config'] : func_get_arg(1);
while (($k = array_shift($keys)) !== null) {
if (array_key_exists($k, $config)) {
return count($keys) > 0 ? $this->config(implode('.', $k... | php | {
"resource": ""
} |
q266093 | Application.url | test | public function url($name, array $params = []) {
$uri = $this->uri($name, $params);
return sprintf('//%s/%s', $this->request()->getHttpHost(), ltrim($uri));
} | php | {
"resource": ""
} |
q266094 | Application.get | test | public function get($route, $callable, $name = null, array $events = null) {
$this['router']->map('GET', $route, $callable, $name);
if ($name && is_array($events)) {
$this->routeEvents[$name] = $events;
}
return $this;
} | php | {
"resource": ""
} |
q266095 | Application.html | test | public function html($content = null, $status = 200) {
$r = new Response($content, $status);
$r->headers->set('Content-Type', 'text/html; charset=utf-8');
$r->setCharset('UTF-8');
return $r;
} | php | {
"resource": ""
} |
q266096 | Application.redirect | test | public function redirect($url = null, $status = 302) {
$r = new RedirectResponse($url, $status);
$r->setCharset('UTF-8');
return $r;
} | php | {
"resource": ""
} |
q266097 | PathSegmentsAwareTrait._setPathSegments | test | protected function _setPathSegments($segments)
{
/*
* `PathSegmentsAwareInterface#getPathSegments()` disallows `stdClass`.
*/
if ($segments instanceof stdClass) {
$segments = (array) $segments;
}
$segments = $this->_normalizeIterable($segments);
... | php | {
"resource": ""
} |
q266098 | ProxyBuilder.getProxy | test | public function getProxy()
{
include_once(__DIR__ . '/Generator.php');
$proxyClass = Generator::generate(
$this->className, $this->methods, $this->properties, $this->proxyClassName, $this->autoload
);
$classname = $proxyClass['proxyClassName'];
if (!empty($prox... | php | {
"resource": ""
} |
q266099 | ProxyBuilder.getInstanceOf | test | protected function getInstanceOf($classname)
{
// As of PHP5.4 the reflection api provides a way to get an instance
// of a class without invoking the constructor.
if (method_exists('ReflectionClass', 'newInstanceWithoutConstructor')) {
$reflectedClass = new \ReflectionClass($cla... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.