_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q257200 | PDODriver._execute | test | protected function _execute()
{
try {
$this->_wrapPrepareSql();
$this->_pdoSt = $this->_pdo->prepare($this->_prepare_sql);
$this->_bindParams();
$this->_pdoSt->execute();
$this->_reset(); // memory-resident mode, singleton pattern, need reset buil... | php | {
"resource": ""
} |
q257201 | PDODriver._bindParams | test | protected function _bindParams()
{
if (is_array($this->_bind_params)) {
foreach ($this->_bind_params as $plh => $param) {
$data_type = PDO::PARAM_STR;
if (is_numeric($param)) {
$data_type = PDO::PARAM_INT;
}
... | php | {
"resource": ""
} |
q257202 | PDODriver._wrapTable | test | protected function _wrapTable($table)
{
$prefix = array_key_exists('prefix', $this->_config) ?
$this->_config['prefix'] : '';
return $prefix.$table;
} | php | {
"resource": ""
} |
q257203 | PDODriver._wrapRow | test | protected static function _wrapRow($str)
{
// match pattern
$alias_pattern = '/([a-zA-Z0-9_\.]+)\s+(AS|as|As)\s+([a-zA-Z0-9_]+)/';
$alias_replace = self::_quote('$1').' $2 '.self::_quote('$3');
$prefix_pattern = '/([a-zA-Z0-9_]+\s*)(\.)(\s*[a-zA-Z0-9_]+)/';
$prefix_replace = ... | php | {
"resource": ""
} |
q257204 | PDODriver._condition_constructor | test | protected function _condition_constructor($args_num, $params, &$construct_str)
{
// params dose not conform to specification
if ( ! $args_num || $args_num > 3) {
throw new \InvalidArgumentException("Error number of parameters");
}
// argurment mode
switch ($args_n... | php | {
"resource": ""
} |
q257205 | PDODriver._storeBuildAttr | test | protected function _storeBuildAttr()
{
// attribute need to store
$store = [];
// store attr
foreach ($this->_buildAttrs as $buildAttr) {
$store[$buildAttr] = $this->$buildAttr;
}
return $store;
} | php | {
"resource": ""
} |
q257206 | PDODriver._reStoreBuildAttr | test | protected function _reStoreBuildAttr(array $data)
{
foreach ($this->_buildAttrs as $buildAttr) {
$this->$buildAttr = $data[$buildAttr];
}
} | php | {
"resource": ""
} |
q257207 | PDODriver._subBuilder | test | protected function _subBuilder(Closure $callback)
{
// store build attr
$store = $this->_storeBuildAttr();
/**************** begin sub query build ****************/
// empty attribute
$this->_resetBuildAttr();
// call sub query callback
call_u... | php | {
"resource": ""
} |
q257208 | PDODriver.select | test | public function select()
{
$cols = func_get_args();
if ( ! func_num_args() || in_array('*', $cols)) {
$this->_cols_str = ' * ';
} else {
// _cols_str default ' * ' , it easy to get a result when select func dosen't called
// but when you call select func ... | php | {
"resource": ""
} |
q257209 | PDODriver.where | test | public function where()
{
$operator = 'AND';
// is the first time call where method ?
if ($this->_where_str == '') {
$this->_where_str = ' WHERE ';
} else {
$this->_where_str .= ' '.$operator.' ';
}
// build attribute, bind params
$this... | php | {
"resource": ""
} |
q257210 | PDODriver.orWhere | test | public function orWhere()
{
$operator = 'OR';
// is the first time call where method ?
if ($this->_where_str == '') {
$this->_where_str = ' WHERE ';
} else {
$this->_where_str .= ' '.$operator.' ';
}
// build attribute, bind params
$thi... | php | {
"resource": ""
} |
q257211 | PDODriver.whereIn | test | public function whereIn($field, array $data, $condition = 'IN', $operator = 'AND')
{
if ( ! in_array($condition, ['IN', 'NOT IN']) || ! in_array($operator, ['AND', 'OR'])) {
throw new \InvalidArgumentException("Error whereIn mode");
}
// create placeholder
foreach ($data ... | php | {
"resource": ""
} |
q257212 | PDODriver.whereBetween | test | public function whereBetween($field, $start, $end, $operator = 'AND')
{
if ( ! in_array($operator, ['AND', 'OR'])) {
throw new \InvalidArgumentException("Logical operator");
}
// create placeholder
$start_plh = self::_getPlh();
$end_plh = self::_getPlh();
... | php | {
"resource": ""
} |
q257213 | PDODriver.whereNull | test | public function whereNull($field, $condition = 'NULL', $operator = 'AND')
{
if ( ! in_array($condition, ['NULL', 'NOT NULL']) || ! in_array($operator, ['AND', 'OR'])) {
throw new \InvalidArgumentException("Logical operator");
}
// is the first time call where method ?
if ... | php | {
"resource": ""
} |
q257214 | PDODriver.whereBrackets | test | public function whereBrackets(Closure $callback, $operator = 'AND')
{
if ( ! in_array($operator, ['AND', 'OR'])) {
throw new \InvalidArgumentException("Logical operator");
}
// first time call where ?
if ($this->_where_str == '') {
$this->_where_str = ' WHERE ... | php | {
"resource": ""
} |
q257215 | PDODriver.whereExists | test | public function whereExists(Closure $callback, $condition = 'EXISTS', $operator = 'AND')
{
if ( ! in_array($condition, ['EXISTS', 'NOT EXISTS']) || ! in_array($operator, ['AND', 'OR'])) {
throw new \InvalidArgumentException("Error whereExists mode");
}
// first time call where ?
... | php | {
"resource": ""
} |
q257216 | PDODriver.whereInSub | test | public function whereInSub($field, Closure $callback, $condition = 'IN', $operator = 'AND')
{
if ( ! in_array($condition, ['IN', 'NOT IN']) || ! in_array($operator, ['AND', 'OR'])) {
throw new \InvalidArgumentException("Error whereIn mode");
}
// first time call where ?
i... | php | {
"resource": ""
} |
q257217 | PDODriver.groupBy | test | public function groupBy($field)
{
// is the first time call groupBy method ?
if ($this->_groupby_str == '') {
$this->_groupby_str = ' GROUP BY '.self::_wrapRow($field);
} else {
$this->_groupby_str .= ' , '.self::_wrapRow($field);
}
return $this;
... | php | {
"resource": ""
} |
q257218 | PDODriver.having | test | public function having()
{
$operator = 'AND';
// is the first time call where method ?
if ($this->_having_str == '') {
$this->_having_str = ' HAVING ';
} else {
$this->_having_str .= ' '.$operator.' ';
}
// build attribute, bind params
... | php | {
"resource": ""
} |
q257219 | PDODriver.orHaving | test | public function orHaving()
{
$operator = 'OR';
// is the first time call where method ?
if ($this->_having_str == '') {
$this->_having_str = ' HAVING ';
} else {
$this->_having_str .= ' '.$operator.' ';
}
// build attribute, bind params
... | php | {
"resource": ""
} |
q257220 | PDODriver.orderBy | test | public function orderBy($field, $mode = 'ASC')
{
$mode = strtoupper($mode);
if ( ! in_array($mode, ['ASC', 'DESC'])) {
throw new \InvalidArgumentException("Error order by mode");
}
// is the first time call orderBy method ?
if ($this->_orderby_str == '') {
... | php | {
"resource": ""
} |
q257221 | PDODriver.join | test | public function join($table, $one, $two, $type = 'INNER')
{
if ( ! in_array($type, ['INNER', 'LEFT', 'RIGHT'])) {
throw new \InvalidArgumentException("Error join mode");
}
// set table prefix
$table = $this->_wrapTable($table);
// create join string
$this-... | php | {
"resource": ""
} |
q257222 | PDODriver.fromSub | test | public function fromSub(Closure $callback)
{
$sub_attr = $this->_subBuilder($callback);
$this->_table .= ' ( '.$sub_attr['_prepare_sql'].' ) AS tb_'.uniqid().' ';
return $this;
} | php | {
"resource": ""
} |
q257223 | PDODriver.paginate | test | public function paginate($step, $page = NULL)
{
// store build attr\bind param
$store = $this->_storeBuildAttr();
$bind_params = $this->_storeBindParam();
// get count
$count = $this->count();
// restore build attr\bind param
$this->_reStoreBuildAttr($store);
... | php | {
"resource": ""
} |
q257224 | PDODriver.get | test | public function get()
{
$this->_buildQuery();
$this->_execute();
return $this->_pdoSt->fetchAll(PDO::FETCH_ASSOC);
} | php | {
"resource": ""
} |
q257225 | PDODriver.row | test | public function row()
{
$this->_buildQuery();
$this->_execute();
return $this->_pdoSt->fetch(PDO::FETCH_ASSOC);
} | php | {
"resource": ""
} |
q257226 | PDODriver.getList | test | public function getList($field)
{
$this->_cols_str = ' '.self::_quote($field).' ';
$this->_buildQuery();
$this->_execute();
return $this->_pdoSt->fetchAll(PDO::FETCH_COLUMN, 0);
} | php | {
"resource": ""
} |
q257227 | PDODriver.query | test | public function query($sql)
{
try {
return $this->_pdo->query($sql);
} catch (PDOException $e) {
// when time out, reconnect
if ($this->_isTimeout($e)) {
$this->_closeConnection();
$this->_connect();
try {
... | php | {
"resource": ""
} |
q257228 | PDODriver.prepare | test | public function prepare($sql, array $driver_options = [])
{
try {
return $this->_pdo->prepare($sql, $driver_options);
} catch (PDOException $e) {
// when time out, reconnect
if ($this->_isTimeout($e)) {
$this->_closeConnection();
$... | php | {
"resource": ""
} |
q257229 | PDODriver.beginTrans | test | public function beginTrans()
{
try {
return $this->_pdo->beginTransaction();
} catch (PDOException $e) {
// when time out, reconnect
if ($this->_isTimeout($e)) {
$this->_closeConnection();
$this->_connect();
try {
... | php | {
"resource": ""
} |
q257230 | ExceptionHandler.handle | test | public function handle(\Exception $e)
{
$httpCode = 500;
// create http response header
if (property_exists($e, 'httpCode') &&
array_key_exists($e->httpCode, Response::$statusCodes)
) { // is a http exception
$httpCode = $e->httpCode;
$header = Res... | php | {
"resource": ""
} |
q257231 | Client.generateId | test | public function generateId($size = 0, $mode = self::MODE_NORMAL)
{
$size = $size>0? $size: $this->size;
switch ($mode) {
case self::MODE_DYNAMIC:
return $this->core->random($this->generator, $size);
default:
return $this->normalRandom($size);
... | php | {
"resource": ""
} |
q257232 | Client.formatedId | test | public function formatedId($alphabet, $size, GeneratorInterface $generator = null)
{
$generator = $generator?:$this->generator;
$alphabet = $alphabet?:CoreInterface::SAFE_SYMBOLS;
return $this->core->random($generator, $size, $alphabet);
} | php | {
"resource": ""
} |
q257233 | Client.normalRandom | test | private function normalRandom($size)
{
$id = '';
while (1 <= $size--) {
$rand = mt_rand()/(mt_getrandmax() + 1);
$id .= $this->alphbet[$rand*64 | 0];
}
return $id;
} | php | {
"resource": ""
} |
q257234 | Connection.normalizeDSN | test | public static function normalizeDSN($dsn, $user = null, $pass = null)
{
// Try to dissect DSN into parts
$parts = is_array($dsn) ? $dsn : parse_url($dsn);
// If parts are usable, convert DSN format
if ($parts !== false && isset($parts['host'], $parts['path'])) {
// DSN i... | php | {
"resource": ""
} |
q257235 | Connection.dsql | test | public function dsql($properties = [])
{
$c = $this->query_class;
$q = new $c($properties);
$q->connection = $this;
return $q;
} | php | {
"resource": ""
} |
q257236 | Connection.execute | test | public function execute(Expression $expr)
{
// If custom connection is set, execute again using that
if ($this->connection && $this->connection !== $this) {
return $expr->execute($this->connection);
}
throw new Exception('Queries cannot be executed through this connectio... | php | {
"resource": ""
} |
q257237 | Connection.beginTransaction | test | public function beginTransaction()
{
// transaction starts only if it was not started before
$r = $this->inTransaction()
? false
: $this->connection->beginTransaction();
$this->transaction_depth++;
return $r;
} | php | {
"resource": ""
} |
q257238 | Connection.commit | test | public function commit()
{
// check if transaction is actually started
if (!$this->inTransaction()) {
throw new Exception('Using commit() when no transaction has started');
}
$this->transaction_depth--;
if ($this->transaction_depth == 0) {
return $th... | php | {
"resource": ""
} |
q257239 | Connection.rollBack | test | public function rollBack()
{
// check if transaction is actually started
if (!$this->inTransaction()) {
throw new Exception('Using rollBack() when no transaction has started');
}
$this->transaction_depth--;
if ($this->transaction_depth == 0) {
return... | php | {
"resource": ""
} |
q257240 | Connection_Oracle.lastInsertID | test | public function lastInsertID($m = null)
{
if ($m instanceof \atk4\data\Model) {
// if we use sequence, then we can easily get current value
if (isset($m->sequence)) {
return $this->dsql()->mode('seq_currval')->sequence($m->sequence)->getOne();
}
... | php | {
"resource": ""
} |
q257241 | Expression.reset | test | public function reset($tag = null)
{
// unset all arguments
if ($tag === null) {
$this->args = ['custom' => []];
return $this;
}
if (!is_string($tag)) {
throw new Exception([
'Tag should be string',
'tag' => $tag,
... | php | {
"resource": ""
} |
q257242 | Expression._consume | test | protected function _consume($sql_code, $escape_mode = 'param')
{
if (!is_object($sql_code)) {
switch ($escape_mode) {
case 'param':
return $this->_param($sql_code);
case 'escape':
return $this->_escape($sql_code);
... | php | {
"resource": ""
} |
q257243 | Expression._escapeSoft | test | protected function _escapeSoft($value)
{
// supports array
if (is_array($value)) {
return array_map(__METHOD__, $value);
}
// in some cases we should not escape
if ($this->isUnescapablePattern($value)) {
return $value;
}
if (is_string... | php | {
"resource": ""
} |
q257244 | Expression.render | test | public function render()
{
$nameless_count = 0;
if (!isset($this->_paramBase)) {
$this->_paramBase = $this->paramBase;
}
if ($this->template === null) {
throw new Exception('Template is not defined for Expression');
}
$res = preg_replace_call... | php | {
"resource": ""
} |
q257245 | Expression.getDebugQuery | test | public function getDebugQuery($html = null)
{
$d = $this->render();
$pp = [];
foreach (array_reverse($this->params) as $key => $val) {
if (is_numeric($val)) {
$d = preg_replace(
'/'.$key.'([^_]|$)/',
$val.'\1',
... | php | {
"resource": ""
} |
q257246 | Expression.get | test | public function get()
{
$stmt = $this->execute();
if ($stmt instanceof \Generator) {
return iterator_to_array($stmt);
}
return $stmt->fetchAll();
} | php | {
"resource": ""
} |
q257247 | Expression.getOne | test | public function getOne()
{
$data = $this->getRow();
if (!$data) {
throw new Exception([
'Unable to fetch single cell of data for getOne from this query',
'result' => $data,
'query' => $this->getDebugQuery(),
]);
}
... | php | {
"resource": ""
} |
q257248 | Expression.getRow | test | public function getRow()
{
$stmt = $this->execute();
if ($stmt instanceof \Generator) {
return $stmt->current();
}
return $stmt->fetch();
} | php | {
"resource": ""
} |
q257249 | Query.table | test | public function table($table, $alias = null)
{
// comma-separated table names
if (is_string($table) && strpos($table, ',') !== false) {
$table = explode(',', $table);
}
// array of tables - recursively process each
if (is_array($table)) {
if ($alias !... | php | {
"resource": ""
} |
q257250 | Query.where | test | public function where($field, $cond = null, $value = null, $kind = 'where', $num_args = null)
{
// Number of passed arguments will be used to determine if arguments were specified or not
if ($num_args === null) {
$num_args = func_num_args();
}
// Array as first argument ... | php | {
"resource": ""
} |
q257251 | Query.__render_condition | test | protected function __render_condition($row)
{
if (count($row) === 3) {
list($field, $cond, $value) = $row;
} elseif (count($row) === 2) {
list($field, $cond) = $row;
} elseif (count($row) === 1) {
list($field) = $row;
}
$field = $this->_co... | php | {
"resource": ""
} |
q257252 | Query.group | test | public function group($group)
{
// Case with comma-separated fields
if (is_string($group) && !$this->isUnescapablePattern($group) && strpos($group, ',') !== false) {
$group = explode(',', $group);
}
if (is_array($group)) {
foreach ($group as $g) {
... | php | {
"resource": ""
} |
q257253 | Query.set | test | public function set($field, $value = null)
{
if ($value === false) {
throw new Exception([
'Value "false" is not supported by SQL',
'field' => $field,
'value' => $value,
]);
}
if (is_array($value)) {
throw n... | php | {
"resource": ""
} |
q257254 | Query.option | test | public function option($option, $mode = 'select')
{
// Case with comma-separated options
if (is_string($option) && strpos($option, ',') !== false) {
$option = explode(',', $option);
}
if (is_array($option)) {
foreach ($option as $opt) {
$this-... | php | {
"resource": ""
} |
q257255 | Query.order | test | public function order($order, $desc = null)
{
// Case with comma-separated fields or first argument being an array
if (is_string($order) && strpos($order, ',') !== false) {
$order = explode(',', $order);
}
if (is_array($order)) {
if ($desc !== null) {
... | php | {
"resource": ""
} |
q257256 | Query.mode | test | public function mode($mode)
{
$prop = 'template_'.$mode;
if (isset($this->{$prop})) {
$this->mode = $mode;
$this->template = $this->{$prop};
} else {
throw new Exception([
'Query does not have this mode',
'mode' => $mode,
... | php | {
"resource": ""
} |
q257257 | Query_Oracle.limit | test | public function limit($cnt, $shift = null)
{
// This is for pre- 12c version
$this->template_select = $this->template_select_limit;
return parent::limit($cnt, $shift);
} | php | {
"resource": ""
} |
q257258 | ValueParser.parseString | test | private function parseString($value)
{
$single = false;
$regex = self::REGEX_QUOTE_DOUBLE_STRING;
$symbol = '"';
if ($this->parser->string_helper->startsWith('\'', $value)) {
$single = true;
$regex = self::REGEX_QUOTE_SINGLE_STRING;
$symbol = "'"... | php | {
"resource": ""
} |
q257259 | ValueParser.fetchStringMatches | test | private function fetchStringMatches($value, $regex, $symbol)
{
if (!preg_match('/'.$regex.'/', $value, $matches)) {
throw new ParseException(
sprintf('Missing end %s quote', $symbol),
$value,
$this->parser->line_num
);
}
... | php | {
"resource": ""
} |
q257260 | ParseException.createMessage | test | private function createMessage($message, $line, $line_num)
{
if (!is_null($line)) {
$message .= sprintf(" near %s", $line);
}
if (!is_null($line_num)) {
$message .= sprintf(" at line %d", $line_num);
}
return $message;
} | php | {
"resource": ""
} |
q257261 | StringHelper.startsWith | test | public function startsWith($string, $line)
{
return $string === "" || strrpos($line, $string, -strlen($line)) !== false;
} | php | {
"resource": ""
} |
q257262 | VariableParser.fetchVariableMatches | test | private function fetchVariableMatches($value)
{
preg_match_all('/' . self::REGEX_ENV_VARIABLE . '/', $value, $matches);
if (!is_array($matches) || !isset($matches[0]) || empty($matches[0])) {
return false;
}
return $matches;
} | php | {
"resource": ""
} |
q257263 | VariableParser.hasParameterExpansion | test | private function hasParameterExpansion($variable)
{
if ((strpos($variable, self::SYMBOL_DEFAULT_VALUE) !== false) ||
(strpos($variable, self::SYMBOL_ASSIGN_DEFAULT_VALUE) !== false)
) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q257264 | VariableParser.fetchParameterExpansion | test | private function fetchParameterExpansion($variable_name)
{
$parameter_type = $this->fetchParameterExpansionType($variable_name);
list($parameter_symbol, $empty_flag) = $this->fetchParameterExpansionSymbol($variable_name, $parameter_type);
list($variable, $default) = $this->splitVariableDefa... | php | {
"resource": ""
} |
q257265 | VariableParser.fetchParameterExpansionSymbol | test | private function fetchParameterExpansionSymbol($variable_name, $type)
{
$class = new \ReflectionClass($this);
$symbol = $class->getConstant('SYMBOL_'.strtoupper($type));
$pos = strpos($variable_name, $symbol);
$check_empty = substr($variable_name, ($pos - 1), 1) === ":";
if... | php | {
"resource": ""
} |
q257266 | VariableParser.splitVariableDefault | test | private function splitVariableDefault($variable_name, $parameter_symbol)
{
$variable_default = explode($parameter_symbol, $variable_name, 2);
if (count($variable_default) !== 2 || empty($variable_default[1])) {
throw new ParseException(
'You must have valid parameter exp... | php | {
"resource": ""
} |
q257267 | VariableParser.parseVariableParameter | test | private function parseVariableParameter($variable, $default, $exists, $empty, $type)
{
if ($exists && !$empty) {
return $this->getVariable($variable);
}
return $this->assignVariableParameterDefault($variable, $default, $empty, $type);
} | php | {
"resource": ""
} |
q257268 | VariableParser.assignVariableParameterDefault | test | private function assignVariableParameterDefault($variable, $default, $empty, $type)
{
$default = $this->parser->value_parser->parse($default);
if ($type === "assign_default_value" && $empty) {
$this->parser->lines[$variable] = $default;
}
return $default;
} | php | {
"resource": ""
} |
q257269 | VariableParser.hasVariable | test | private function hasVariable($variable)
{
if (array_key_exists($variable, $this->parser->lines)) {
return true;
}
if (array_key_exists($variable, $this->context)) {
return true;
}
return false;
} | php | {
"resource": ""
} |
q257270 | VariableParser.getVariable | test | private function getVariable($variable)
{
if (array_key_exists($variable, $this->parser->lines)) {
return $this->parser->lines[$variable];
}
if (array_key_exists($variable, $this->context)) {
return $this->context[$variable];
}
return null;
} | php | {
"resource": ""
} |
q257271 | KeyParser.parse | test | public function parse($key)
{
$key = trim($key);
if ($this->parser->string_helper->startsWith('#', $key)) {
return false;
}
if (!ctype_alnum(str_replace('_', '', $key)) || $this->parser->string_helper->startsWithNumber($key)) {
throw new ParseException(
... | php | {
"resource": ""
} |
q257272 | Parser.doParse | test | protected function doParse($content)
{
$raw_lines = array_filter($this->makeLines($content), 'strlen');
if (empty($raw_lines)) {
return;
}
return $this->parseContent($raw_lines);
} | php | {
"resource": ""
} |
q257273 | Parser.parseContent | test | private function parseContent(array $raw_lines)
{
$this->lines = array();
$this->line_num = 0;
foreach ($raw_lines as $raw_line) {
$this->line_num++;
if ($this->string_helper->startsWith('#', $raw_line) || !$raw_line) {
continue;
}
... | php | {
"resource": ""
} |
q257274 | Parser.parseLine | test | private function parseLine($raw_line)
{
$raw_line = $this->parseExport($raw_line);
list($key, $value) = $this->parseKeyValue($raw_line);
$key = $this->key_parser->parse($key);
if (!is_string($key)) {
return;
}
$this->lines[$key] = $this->value_parser->... | php | {
"resource": ""
} |
q257275 | Parser.parseExport | test | private function parseExport($raw_line)
{
$line = trim($raw_line);
if ($this->string_helper->startsWith("export", $line)) {
$export_line = explode("export", $raw_line, 2);
if (count($export_line) !== 2 || empty($export_line[1])) {
throw new ParseException(
... | php | {
"resource": ""
} |
q257276 | Parser.parseKeyValue | test | private function parseKeyValue($raw_line)
{
$key_value = explode("=", $raw_line, 2);
if (count($key_value) !== 2) {
throw new ParseException(
'You must have a key = value',
$raw_line,
$this->line_num
);
}
retur... | php | {
"resource": ""
} |
q257277 | Parser.getContent | test | public function getContent($keyName = null)
{
if (!is_null($keyName)) {
return (array_key_exists($keyName, $this->lines)) ? $this->lines[$keyName] : null;
}
return $this->lines;
} | php | {
"resource": ""
} |
q257278 | Client.startTask | test | public function startTask(TaskInterface $task)
{
$response = $this->http->post($this->getTaskWorkerUrl(), [
self::ATTR_PROG => self::PROG,
self::ATTR_NAME => get_class($task),
self::ATTR_DATA => $this->serializer->encode($this->properties->getPropertiesFromObject($task)),... | php | {
"resource": ""
} |
q257279 | Client.startWorkflow | test | public function startWorkflow(WorkflowInterface $flow)
{
$canonical = null;
// if $flow is a versionned workflow
if ($flow instanceof VersionedWorkflow) {
// store canonical name
$canonical = get_class($flow);
// replace by true current implementation
... | php | {
"resource": ""
} |
q257280 | Client.findWorkflow | test | public function findWorkflow($workflowName, $customId)
{
$params = [
static::ATTR_ID => $customId,
static::ATTR_NAME => $workflowName,
static::ATTR_PROG => static::PROG,
];
$response = $this->http->get($this->getInstanceWebsiteUrl($params));
if ($... | php | {
"resource": ""
} |
q257281 | WithTimestamp._getTimestampOrDuration | test | public function _getTimestampOrDuration()
{
if (null === $this->_buffer) {
return [null, null];
}
list($now, $then) = $this->_initNowThen();
$this->_mode = null;
// apply buffered methods
foreach ($this->_buffer as $call) {
$then = $this->_ap... | php | {
"resource": ""
} |
q257282 | Properties.getClassProperties | test | private function getClassProperties($argument, $filter = null)
{
if (null === $filter) {
$filter = \ReflectionProperty::IS_STATIC | \ReflectionProperty::IS_PUBLIC | \ReflectionProperty::IS_PROTECTED | \ReflectionProperty::IS_PRIVATE;
}
$reflectionClass = new \ReflectionClass($ar... | php | {
"resource": ""
} |
q257283 | SonataSeoExtension.configureSitemap | test | protected function configureSitemap(array $config, ContainerBuilder $container)
{
$source = $container->getDefinition('sonata.seo.sitemap.manager');
if (method_exists($source, 'setShared')) { // Symfony 2.8+
$source->setShared(false);
} else {
// For Symfony <2.8 com... | php | {
"resource": ""
} |
q257284 | SonataSeoExtension.fixConfiguration | test | protected function fixConfiguration(array $config)
{
foreach ($config['sitemap']['doctrine_orm'] as $pos => $sitemap) {
$sitemap['group'] = $sitemap['group'] ?? false;
$sitemap['types'] = $sitemap['types'] ?? [];
$sitemap['connection'] = $sitemap['connection'] ?? 'doctrin... | php | {
"resource": ""
} |
q257285 | SourceManager.addSource | test | public function addSource($group, SourceIteratorInterface $source, array $types = [])
{
if (!isset($this->sources[$group])) {
$this->sources[$group] = new \stdClass();
$this->sources[$group]->sources = new ChainSourceIterator();
$this->sources[$group]->types = [];
... | php | {
"resource": ""
} |
q257286 | BreadcrumbListener.onBlock | test | public function onBlock(BlockEvent $event)
{
$context = $event->getSetting('context', null);
if (null === $context) {
return;
}
foreach ($this->blockServices as $type => $blockService) {
if ($blockService->handleContext($context)) {
$block = ... | php | {
"resource": ""
} |
q257287 | BaseBreadcrumbMenuBlockService.getRootMenu | test | protected function getRootMenu(BlockContextInterface $blockContext)
{
$settings = $blockContext->getSettings();
/*
* @todo : Use the router to get the homepage URI
*/
$menu = $this->factory->createItem('breadcrumb');
$menu->setChildrenAttribute('class', 'breadcrum... | php | {
"resource": ""
} |
q257288 | Iconpicker.getFonts | test | private function getFonts()
{
if (empty($this->fonts)) {
$files = FileHelper::findFiles(Craft::getAlias(self::FONT_DIR), ['only' => self::FONT_EXT]);
$filenames = [];
$fonts = [];
foreach ($files as $file) {
$pathInfo = pathinfo($file);
... | php | {
"resource": ""
} |
q257289 | Iconpicker.getIcons | test | private function getIcons()
{
if (!empty($this->iconFont)) {
$fonts = $this->getFonts();
if (!empty($fonts) && isset($fonts[$this->iconFont])) {
$font = Font::load($fonts[$this->iconFont]['path']);
$font->parse();
if ($font !== null) {... | php | {
"resource": ""
} |
q257290 | Iconpicker.getFontCss | test | public function getFontCss()
{
$sharedAsset = new sharedAsset();
$scss = "";
foreach ($this->getFonts() as $safeName => $pathInfo) {
$fontFile = $pathInfo['path'];
$font = Font::load($fontFile);
$font->parse();
if (!empty($font)) {
... | php | {
"resource": ""
} |
q257291 | PasswordLock.hashAndEncrypt | test | public static function hashAndEncrypt(string $password, Key $aesKey): string
{
/** @var string $hash */
$hash = \password_hash(
Base64::encode(
\hash('sha384', $password, true)
),
PASSWORD_DEFAULT
);
if (!\is_string($hash)) {
... | php | {
"resource": ""
} |
q257292 | PasswordLock.upgradeFromVersion1 | test | public static function upgradeFromVersion1(
string $password,
string $ciphertext,
string $oldKey,
Key $newKey
): string {
if (!self::decryptAndVerifyLegacy($password, $ciphertext, $oldKey)) {
throw new \Exception(
'The correct password is necessary... | php | {
"resource": ""
} |
q257293 | ExplainCommand.execute | test | protected function execute(InputInterface $input, OutputInterface $output)
{
$this->init($input, $output);
$config = $this->initConfiguration($input->getOption('config_file'));
$rules = $config->getRules();
foreach ($rules as $name => $rule) {
$info = Init::getInitInfo... | php | {
"resource": ""
} |
q257294 | SmokeCommand.writeSmokeCredentials | test | protected function writeSmokeCredentials($url = null)
{
if (defined('SMOKE_CREDENTIALS')) {
$this->output->writeln("\n " . SMOKE_CREDENTIALS . "\n");
} else {
$this->output->writeln("\n Smoke " . SMOKE_VERSION . " by Nils Langner\n");
}
if ($url) {
... | php | {
"resource": ""
} |
q257295 | SmokeCommand.getConfigArray | test | protected function getConfigArray($configFile, $mandatory = false)
{
$configArray = array();
if ($configFile) {
if (strpos($configFile, 'http://') === 0 || strpos($configFile, 'https://') === 0) {
$curlClient = new Client();
$fileContent = (string)$curlCl... | php | {
"resource": ""
} |
q257296 | ForeignDomainFilter.isFiltered | test | public function isFiltered(UriInterface $currentUri, UriInterface $startUri)
{
/* @var $currentUri Uri */
/* @var $startUri Uri */
$startDomainElements = explode('.', $startUri->getHost());
$currentDomainElements = explode('.', $currentUri->getHost());
$startDomainLength = ... | php | {
"resource": ""
} |
q257297 | Application.registerCommands | test | private function registerCommands()
{
$this->add(new ScanCommand());
$this->add(new ExplainCommand());
$this->add(new WarmUpCommand());
$this->add(new CustomCommand());
} | php | {
"resource": ""
} |
q257298 | TemplateFinder.findAllTemplates | test | public function findAllTemplates()
{
if (null !== $this->templates) {
return $this->templates;
}
//All themes
$this->themes = $this->themeManager->getThemes();
$templates = array();
foreach ($this->kernel->getBundles() as $bundle) {
$template... | php | {
"resource": ""
} |
q257299 | TemplateFinder.findTemplatesInBundle | test | private function findTemplatesInBundle(BundleInterface $bundle)
{
$name = $bundle->getName();
$templates = array_merge(
$this->findTemplatesInFolder($bundle->getPath().'/Resources/views'),
$this->findTemplatesInFolder($this->rootDir.'/'.$name.'/views')
);
//追踪... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.