_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q267100 | File.incrVersion | test | public function incrVersion($filename)
{
$pat = "|^\d+$|";
$parts = explode(".", $filename);
$partsCount = count($parts);
if ($partsCount == 1) {
return $filename . ".1";
}
if ($partsCount == 2) {
if (preg_match($pat, $parts[1])) {
... | php | {
"resource": ""
} |
q267101 | Response.getBody | test | public function getBody($format = 'object')
{
if (! $this->isValidBodyFormat($format)) {
return;
}
$method = 'body' . ucfirst($format);
return call_user_func_array([$this, $method], [null]);
} | php | {
"resource": ""
} |
q267102 | Response.bodyArray | test | protected function bodyArray()
{
if (is_xml($this->body)) {
return xml_decode($this->body, true);
}
if (is_json($this->body)) {
return json_decode($this->body, true);
}
} | php | {
"resource": ""
} |
q267103 | Response.bodyObject | test | protected function bodyObject()
{
if (is_xml($this->body)) {
return xml_decode($this->body);
}
if (is_json($this->body)) {
return json_decode($this->body);
}
} | php | {
"resource": ""
} |
q267104 | QueryService.getResultsFromQuery | test | public function getResultsFromQuery($query, $limit = 0, $connection='default')
{
try
{
$this->queryValidator->isValidQuery($query, $connection);
$query = $this->queryValidator->getLimitedQuery($query, $limit);
$this->dynamicRepo->setUp($connection);
... | php | {
"resource": ""
} |
q267105 | Response.setDefaults | test | public function setDefaults()
{
if ( !$this->getResponseCode() ) $this->setResponseCode(200);
if ( !$this->getContentType() ) $this->setContentType('text/html');
if ( !$this->getServer() ) $this->setServer('Skeetr 0.0.1');
} | php | {
"resource": ""
} |
q267106 | Response.setBody | test | public function setBody(Body $body)
{
parent::setBody($body);
return $this->addHeaders(array(
'Content-Length' => (string) strlen($this->body)
), true);
} | php | {
"resource": ""
} |
q267107 | Response.toArray | test | public function toArray($default = true)
{
if ( $default ) $this->setDefaults();
return array(
'responseCode' => $this->getResponseCode(),
'body' => $this->getBody()->toString(),
'headers' => $this->getHeaders()
);
} | php | {
"resource": ""
} |
q267108 | Versions.getUniqueValidationRule | test | protected function getUniqueValidationRule($field) {
$rule = 'unique:' . get_class($this) . ',' . $field . ',' . $this->getHeadId() . ',id';
// ignore other versions of this entity
if($this->getHeadId()) {
$rule .= ',headVersion,!=,' . $this->getHeadId();
}
return $... | php | {
"resource": ""
} |
q267109 | Url.fromS3 | test | public function fromS3($key, $expiration = null, $downloadAs = null)
{
$args = array();
if (!empty($downloadAs)) {
if (empty($expiration)) {
throw new \RuntimeException("Unable to set download name on URL without expiration.");
}
$args['ResponseCon... | php | {
"resource": ""
} |
q267110 | Adodb.getAdapter | test | public static function getAdapter(\ADOConnection $adoConnection)
{
$adoConnectionDriver = strtolower(get_class($adoConnection));
switch ($adoConnectionDriver) {
//case 'adodb_mysqlt':
case 'adodb_mysqli':
$connectionId = self::getADOConnectionId($adoConnection... | php | {
"resource": ""
} |
q267111 | Adodb.getADOConnectionId | test | protected static function getADOConnectionId(\ADOConnection $adoConnection)
{
$connectionId = $adoConnection->_connectionID;
if (!$connectionId) {
throw new Exception\AdoNotConnectedException(__METHOD__ . ". Error: Invalid usage, adodb connection must be connected before use (see connect... | php | {
"resource": ""
} |
q267112 | ErrorController.actionError | test | public function actionError(RequestApplicationInterface $app, \Throwable $exception) {
$logMessage = get_class($exception);
if ($exception->getMessage()) {
$logMessage .= "\n" . $exception->getMessage();
}
if ($exception->getFile() || $exception->getLine()) {
$log... | php | {
"resource": ""
} |
q267113 | HTTP_Request2_Adapter_Curl.wrapCurlError | test | protected static function wrapCurlError($ch)
{
$nativeCode = curl_errno($ch);
$message = 'Curl error: ' . curl_error($ch);
if (!isset(self::$errorMap[$nativeCode])) {
return new HTTP_Request2_Exception($message, 0, $nativeCode);
} else {
$class = sel... | php | {
"resource": ""
} |
q267114 | HTTP_Request2_Adapter_Curl.callbackReadBody | test | protected function callbackReadBody($ch, $fd, $length)
{
if (!$this->eventSentHeaders) {
$this->request->setLastEvent(
'sentHeaders', curl_getinfo($ch, CURLINFO_HEADER_OUT)
);
$this->eventSentHeaders = true;
}
if (in_array($this->re... | php | {
"resource": ""
} |
q267115 | HTTP_Request2_Adapter_Curl.callbackWriteHeader | test | protected function callbackWriteHeader($ch, $string)
{
// we may receive a second set of headers if doing e.g. digest auth
if ($this->eventReceivedHeaders || !$this->eventSentHeaders) {
// don't bother with 100-Continue responses (bug #15785)
if (!$this->eventSentHeaders... | php | {
"resource": ""
} |
q267116 | HTTP_Request2_Adapter_Curl.callbackWriteBody | test | protected function callbackWriteBody($ch, $string)
{
// cURL calls WRITEFUNCTION callback without calling HEADERFUNCTION if
// response doesn't start with proper HTTP status line (see bug #15716)
if (empty($this->response)) {
throw new HTTP_Request2_MessageException(
... | php | {
"resource": ""
} |
q267117 | Console.addCommandCollection | test | public function addCommandCollection(CommandCollection $collection)
{
$collection->setConsole($this);
$class = new ClassType($collection);
$this->collections[Strings::lower($class->getShortName())] = $collection;
} | php | {
"resource": ""
} |
q267118 | Console.printTime | test | private function printTime(string $text): void
{
$line = '[' . date('d.m.Y H:i:s', time()) . '] ' . $text;
$this->printLine($line);
} | php | {
"resource": ""
} |
q267119 | Console.printConsoleHelp | test | private function printConsoleHelp(ClassType $class): void
{
$this->printLine($class->getDescription());
$this->printLine();
foreach ($this->getMethod($class) as $method) {
$line = $class->getShortName() . ':' . $method->name;
foreach ($method->getParameters() as $param) {
$line .= ' /' . $param->getN... | php | {
"resource": ""
} |
q267120 | Console.printHtmlHelp | test | private function printHtmlHelp(ClassType $class): void
{
$desc = Html::el('h1');
$desc->setText($class->getDescription());
$this->printLine((string) $desc);
foreach ($this->getMethod($class) as $method) {
$desc = Html::el('pre');
$desc->setStyle('margin-bottom: 0px');
$desc->setText(Strings::replace(... | php | {
"resource": ""
} |
q267121 | Console.printLine | test | public function printLine(string $string = null): void
{
if ($string !== null) {
echo $string;
}
if ($this->isConsole) {
echo "\n";
} else {
echo '<br/>';
}
} | php | {
"resource": ""
} |
q267122 | Application.__async_upload | test | public function __async_upload()
{
/** @var array $result Asynchronous result array */
$result = array('status' => false);
/** @var \samsonphp\upload\Upload $upload Pointer to uploader object */
$upload = null;
// If file was uploaded
if (uploadFile($upload)) {
... | php | {
"resource": ""
} |
q267123 | Application.__async_clearHtml | test | public function __async_clearHtml()
{
// Tags that do not change
$allowed_tags = '<b><i><sup><sub><em><strong><u><br><p><table><tr><td><tbody><thead><h1><h2><h3><h4><img><a>';
// Getting html value
$html = json_decode(file_get_contents('php://input'), true);
// Replace tags c... | php | {
"resource": ""
} |
q267124 | JsonAttributeBehavior.beforeSave | test | public function beforeSave($event)
{
foreach ($this->attributes as $name) {
if (!empty($this->owner->$name)) {
$this->owner->$name = $this->jsonEncodeAttribute($name);
} else {
$this->owner->$name = null;
}
}
} | php | {
"resource": ""
} |
q267125 | JsonAttributeBehavior.afterFind | test | public function afterFind($event)
{
foreach ($this->attributes as $name) {
$this->owner->$name = $this->jsonDecodeAttribute($name);
}
} | php | {
"resource": ""
} |
q267126 | JsonAttributeBehavior.jsonDecodeAttribute | test | public function jsonDecodeAttribute($name, $assoc = true, $depth = 512)
{
$string = json_decode($this->owner->$name, $assoc, $depth);
if (json_last_error() !== JSON_ERROR_NONE) {
throw new CException(sprintf('Failed to decode JSON attribute "%s".', $name));
}
return $stri... | php | {
"resource": ""
} |
q267127 | Factory.create | test | public static function create(Bank $bank, $type)
{
if (!isset(self::$allowedTypes[$type])) {
throw new \Exception('Type is not allowed!');
}
$class = __NAMESPACE__ . '\\' . $bank->getParser();
if (!class_exists($class)) {
throw new \Exception();
}
... | php | {
"resource": ""
} |
q267128 | Zend_Filter_Boolean.setLocale | test | public function setLocale($locale = null)
{
if (is_string($locale)) {
$locale = array($locale);
} elseif ($locale instanceof Zend_Locale) {
$locale = array($locale->toString());
} elseif (!is_array($locale)) {
throw new Zend_Filter_Exception('Locale has t... | php | {
"resource": ""
} |
q267129 | Zend_Filter_Boolean._getLocalizedQuestion | test | protected function _getLocalizedQuestion($value, $yes, $locale)
{
if ($yes == true) {
$question = 'yes';
$return = true;
} else {
$question = 'no';
$return = false;
}
$str = Zend_Locale::getTranslation($question, 'question', $locale... | php | {
"resource": ""
} |
q267130 | HTTP_Request2_Adapter_Socket.establishTunnel | test | protected function establishTunnel()
{
$donor = new self;
$connect = new HTTP_Request2(
$this->request->getUrl(), HTTP_Request2::METHOD_CONNECT,
array_merge($this->request->getConfig(), array('adapter' => $donor))
);
$response = $connect->send();
... | php | {
"resource": ""
} |
q267131 | HTTP_Request2_Adapter_Socket.canKeepAlive | test | protected function canKeepAlive($requestKeepAlive, HTTP_Request2_Response $response)
{
// Do not close socket on successful CONNECT request
if (HTTP_Request2::METHOD_CONNECT == $this->request->getMethod()
&& 200 <= $response->getStatus() && 300 > $response->getStatus()
) {
... | php | {
"resource": ""
} |
q267132 | HTTP_Request2_Adapter_Socket.disconnect | test | protected function disconnect()
{
if (!empty($this->socket)) {
$this->socket = null;
$this->request->setLastEvent('disconnect');
}
} | php | {
"resource": ""
} |
q267133 | HTTP_Request2_Adapter_Socket.handleRedirect | test | protected function handleRedirect(
HTTP_Request2 $request, HTTP_Request2_Response $response
) {
if (is_null($this->redirectCountdown)) {
$this->redirectCountdown = $request->getConfig('max_redirects');
}
if (0 == $this->redirectCountdown) {
$this->redir... | php | {
"resource": ""
} |
q267134 | HTTP_Request2_Adapter_Socket.shouldUseServerDigestAuth | test | protected function shouldUseServerDigestAuth(HTTP_Request2_Response $response)
{
// no sense repeating a request if we don't have credentials
if (401 != $response->getStatus() || !$this->request->getAuth()) {
return false;
}
if (!$challenge = $this->parseDigestChall... | php | {
"resource": ""
} |
q267135 | HTTP_Request2_Adapter_Socket.shouldUseProxyDigestAuth | test | protected function shouldUseProxyDigestAuth(HTTP_Request2_Response $response)
{
if (407 != $response->getStatus() || !$this->request->getConfig('proxy_user')) {
return false;
}
if (!($challenge = $this->parseDigestChallenge($response->getHeader('proxy-authenticate')))) {
... | php | {
"resource": ""
} |
q267136 | HTTP_Request2_Adapter_Socket.writeBody | test | protected function writeBody()
{
if (in_array($this->request->getMethod(), self::$bodyDisallowed)
|| 0 == $this->contentLength
) {
return;
}
$position = 0;
$bufferSize = $this->request->getConfig('buffer_size');
$headers = $this... | php | {
"resource": ""
} |
q267137 | HTTP_Request2_Adapter_Socket.readChunked | test | protected function readChunked($bufferSize)
{
// at start of the next chunk?
if (0 == $this->chunkLength) {
$line = $this->socket->readLine($bufferSize);
if (!preg_match('/^([0-9a-f]+)/i', $line, $matches)) {
throw new HTTP_Request2_MessageException(
... | php | {
"resource": ""
} |
q267138 | grid.sqlBuildSelect | test | public static function sqlBuildSelect($arrSelect, $addSelect = false)
{
$select = null;
if (is_array($arrSelect))
{
foreach ($arrSelect as $f => $v)
{
if ($select) $select .= ', ';
if (preg_match('/^(.+?):(literal)$/i', $f, $a... | php | {
"resource": ""
} |
q267139 | grid.sqlBuildWhere | test | public static function sqlBuildWhere($arrWhere, $whereClause = true)
{
$where = null;
if (is_array($arrWhere))
{
if ($whereClause)
$where = ' WHERE 1 ';
foreach ($arrWhere as $f => $v)
{
if ($where)
$wher... | php | {
"resource": ""
} |
q267140 | grid.sqlBuildJoin | test | public static function sqlBuildJoin($arrJoin)
{
$joins = null;
if (is_array($arrJoin))
{
foreach ($arrJoin as $v)
{
$joins .= $v . " \n";
}
$joins = " \n" . $joins;
}
return $joins;
} | php | {
"resource": ""
} |
q267141 | grid.sqlBuildGroupBy | test | public static function sqlBuildGroupBy($arrGroup, $addGroup = false)
{
$groupBy = $group = null;
if (is_array($arrGroup))
{
$group = '';
foreach ($arrGroup as $k)
{
if ($group) $group .= ', ';
$group .= self::getDS... | php | {
"resource": ""
} |
q267142 | grid.prepareDependencyHandler | test | public static function prepareDependencyHandler($handleType, $field, &$arrField, &$arrGridPrepare, &$arrFormData)
{
// select fields?
if (isset($arrField['dependency']['selectField']) && is_array($arrField['dependency']['selectField']))
{
foreach($arrField['dependency']['se... | php | {
"resource": ""
} |
q267143 | grid.getDataFunctionMergeMapping | test | public static function getDataFunctionMergeMapping(&$arrRows, &$arrResults, &$arrMapping, $arrRowsAdditonalKey = null)
{
if (is_array($arrResults))
{
foreach($arrResults as $mapId => $arrResult)
{
if (isset($arrMapping[$mapId]) && is_array($arrMapping[$mapId])... | php | {
"resource": ""
} |
q267144 | grid.cleanString | test | public static function cleanString($string)
{
$string = str_replace(array(' ', '<br/>', '<br>'), ' ', $string);
$string = strip_tags($string);
$string = str_replace(' ', ' ', $string);
return $string;
} | php | {
"resource": ""
} |
q267145 | CallPrediction.check | test | public function check(array $calls, FunctionProphecy $prophecy)
{
if (count($calls)) {
return;
}
$methodCalls = $prophecy->getNamespace()->findCalls($prophecy->getName(), new ArgumentsWildcard([new AnyValuesToken()]));
if (count($methodCalls)) {
throw new No... | php | {
"resource": ""
} |
q267146 | Zend_Config_Yaml._decodeYaml | test | protected static function _decodeYaml($currentIndent, &$lines)
{
$config = array();
$inIndent = false;
while (list($n, $line) = each($lines)) {
$lineno = $n + 1;
$line = rtrim(preg_replace("/#.*$/", "", $line));
if (strlen($line) == 0) {
... | php | {
"resource": ""
} |
q267147 | PEAR_Task_Replace.startSession | test | function startSession($pkg, $contents, $dest)
{
$subst_from = $subst_to = array();
foreach ($this->_replacements as $a) {
$a = $a['attribs'];
$to = '';
if ($a['type'] == 'pear-config') {
if ($this->installphase == PEAR_TASK_PACKAGE) {
... | php | {
"resource": ""
} |
q267148 | Component.exec | test | public function exec($query, $values = array())
{
if ($stmt = $this->prepare($query)) {
$result = $this->execute($stmt, $values);
$this->close($stmt);
}
return (isset($result)) ? $result : false;
} | php | {
"resource": ""
} |
q267149 | Component.insert | test | public function insert($table, array $data, $and = '')
{
if (isset($this->prepared[$table])) {
return $this->execute($table, $data);
}
$single = (count(array_filter(array_keys($data), 'is_string')) > 0) ? $data : false;
if ($single) {
$data = array_keys($data)... | php | {
"resource": ""
} |
q267150 | Component.update | test | public function update($table, $id, array $data, $and = '')
{
if (isset($this->prepared[$table])) {
$data[] = $id;
return $this->execute($table, $data);
}
$first = each($data);
$single = (is_array($first['value'])) ? $first['value'] : false;
if ($sing... | php | {
"resource": ""
} |
q267151 | Component.upsert | test | public function upsert($table, $id, array $data)
{
if (isset($this->prepared[$table]['ref']) && $this->execute($table, $id)) {
$data[] = $id;
if ($row = $this->fetch($table)) {
return ($this->execute($this->prepared[$table]['ref']['update'], $data)) ? array_shift($row... | php | {
"resource": ""
} |
q267152 | Component.query | test | public function query($select, $values = array(), $fetch = 'row')
{
if ($stmt = $this->prepare($select, $fetch)) {
if ($this->prepared[$stmt]['type'] == 'SELECT' && $this->execute($stmt, $values)) {
return $stmt;
}
$this->close($stmt);
}
r... | php | {
"resource": ""
} |
q267153 | Component.all | test | public function all($select, $values = array(), $fetch = 'row')
{
$rows = array();
if ($stmt = $this->query($select, $values, $fetch)) {
while ($row = $this->fetch($stmt)) {
$rows[] = $row;
}
$this->close($stmt);
}
return $rows;
... | php | {
"resource": ""
} |
q267154 | Component.ids | test | public function ids($select, $values = array())
{
$ids = array();
if ($stmt = $this->query($select, $values, 'row')) {
while ($row = $this->fetch($stmt)) {
$ids[] = (int) array_shift($row);
}
$this->close($stmt);
}
return (!empty($... | php | {
"resource": ""
} |
q267155 | Component.row | test | public function row($select, $values = array(), $fetch = 'row')
{
if ($stmt = $this->query($select, $values, $fetch)) {
$row = $this->fetch($stmt);
$this->close($stmt);
}
return (isset($row) && !empty($row)) ? $row : false;
} | php | {
"resource": ""
} |
q267156 | Component.value | test | public function value($select, $values = array())
{
return ($row = $this->row($select, $values, 'row')) ? array_shift($row) : false;
} | php | {
"resource": ""
} |
q267157 | Component.prepare | test | public function prepare($query, $fetch = null)
{
$query = (is_array($query)) ? trim(implode("\n", $query)) : trim($query);
$stmt = count(static::$logs[$this->id]) + 1;
$start = microtime(true);
$this->prepared[$stmt]['obj'] = $this->dbPrepare($query);
static::$logs[$this->id]... | php | {
"resource": ""
} |
q267158 | Component.execute | test | public function execute($stmt, $values = null)
{
if (isset($this->prepared[$stmt])) {
if (!is_array($values)) {
$values = ($this->prepared[$stmt]['params'] == 1) ? array($values) : array();
}
$start = microtime(true);
if ($this->dbExecute($this... | php | {
"resource": ""
} |
q267159 | Component.fetch | test | public function fetch($stmt)
{
if (isset($this->prepared[$stmt]) && $this->prepared[$stmt]['type'] == 'SELECT') {
return $this->dbFetch($this->prepared[$stmt]['obj'], $this->prepared[$stmt]['style'], $stmt);
}
return false;
} | php | {
"resource": ""
} |
q267160 | Component.log | test | public function log($value = null)
{
$log = (is_numeric($value)) ? static::$logs[$this->id][$value] : end(static::$logs[$this->id]);
if (isset($log['errors'])) {
$log['errors'] = array_count_values($log['errors']);
}
$log['average'] = ($log['count'] > 0) ? $log['executed'... | php | {
"resource": ""
} |
q267161 | ValueFactory.parseValue | test | public function parseValue($value)
{
foreach ($this->mappings as $mapping => $replace) {
if (is_callable($replace)) {
$value = preg_replace_callback($mapping, $replace, $value);
} else {
$value = preg_replace($mapping, $replace, $value);
}
... | php | {
"resource": ""
} |
q267162 | Zend_Filter_PregReplace.filter | test | public function filter($value)
{
if ($this->_matchPattern == null) {
throw new Zend_Filter_Exception(get_class($this) . ' does not have a valid MatchPattern set.');
}
return preg_replace($this->_matchPattern, $this->_replacement, $value);
} | php | {
"resource": ""
} |
q267163 | NativeKernel.dispatchRouter | test | protected function dispatchRouter(Request $request): Response
{
// Set the request object in the container
$this->app->container()->singleton(Request::class, $request);
// Dispatch the before request handled middleware
$middlewareReturn = $this->requestMiddleware($request);
... | php | {
"resource": ""
} |
q267164 | NativeKernel.terminateRouteMiddleware | test | protected function terminateRouteMiddleware(Request $request, Response $response): void
{
// Ensure a route exists
if (! $this->app->container()->isSingleton(Route::class)) {
return;
}
/* @var Route $route */
$route = $this->app->container()->getSingleton(Route::... | php | {
"resource": ""
} |
q267165 | PEAR_XMLParser.startHandler | test | function startHandler($parser, $element, $attribs)
{
$this->_depth++;
$this->_dataStack[$this->_depth] = null;
$val = array(
'name' => $element,
'value' => null,
'type' => 'string',
'childrenKeys' => array(),
... | php | {
"resource": ""
} |
q267166 | PEAR_XMLParser.endHandler | test | function endHandler($parser, $element)
{
$value = array_pop($this->_valStack);
$data = $this->postProcess($this->_dataStack[$this->_depth], $element);
// adjust type of the value
switch (strtolower($value['type'])) {
// unserialize an array
case 'array':
... | php | {
"resource": ""
} |
q267167 | AssetConverter.runCommand | test | protected function runCommand($command, $basePath, $asset, $result)
{
$command = Reaction::$app->getAlias($command);
$command = strtr($command, [
'{from}' => escapeshellarg("$basePath/$asset"),
'{to}' => escapeshellarg("$basePath/$result"),
]);
$descriptor = ... | php | {
"resource": ""
} |
q267168 | NotifyViaSlackJob.process | test | public function process()
{
// $this->channel evaluates to blank in the following if, so store it as a variable
$channel = $this->channel;
$client = new Client($this->webhookURL);
if (empty($channel)) {
$client->send($this->message);
} else {
#Send to... | php | {
"resource": ""
} |
q267169 | CroppableBehavior.modifyUploadableBehavior | test | protected function modifyUploadableBehavior()
{
$table = $this->getTable();
if ($table->hasBehavior('uploadable')) {
$uploadable = $table->getBehavior('uploadable');
$parameters = $uploadable->getParameters();
$up_columns = explode(',', $parameters['columns']);
... | php | {
"resource": ""
} |
q267170 | Request.fromJSON | test | public static function fromJSON($json)
{
$request = new static();
print_r($json);
$data = json_decode($json, true);
print_r($data);
if (!$data) {
throw new UnexpectedValueException(sprintf(
'Unexpected message, invalid JSON from nginx: "%s"', $json
... | php | {
"resource": ""
} |
q267171 | Database.open | test | public function open($savePath, $name)
{
$this->sessionSavePath = $savePath;
$this->sessionName = $name;
return true;
} | php | {
"resource": ""
} |
q267172 | Database.read | test | public function read($id)
{
$idColumn = $this->options->getIdColumn();
$nameColumn = $this->options->getNameColumn();
$adapter = $this->getAdapter();
$sessionData = [
$idColumn => $id,
$nameColumn => $this->sessionName
];
$session = $a... | php | {
"resource": ""
} |
q267173 | Database.destroy | test | public function destroy($id)
{
$idColumn = $this->options->getIdColumn();
$nameColumn = $this->options->getNameColumn();
$adapter = $this->getAdapter();
$sessionData = [
$idColumn => $id,
$nameColumn => $this->sessionName
];
$session ... | php | {
"resource": ""
} |
q267174 | Database.write | test | public function write($id, $data)
{
$idColumn = $this->options->getIdColumn();
$nameColumn = $this->options->getNameColumn();
$dataColumn = $this->options->getDataColumn();
$modifiedColumn = $this->options->getModifiedColumn();
$createdColumn = $this->options->... | php | {
"resource": ""
} |
q267175 | Widget.widget | test | public static function widget($config = [])
{
ob_start();
ob_implicit_flush(false);
try {
/* @var $widget Widget */
$config['class'] = get_called_class();
$widget = Reaction::create($config);
$out = '';
if ($widget->beforeRun()) {
... | php | {
"resource": ""
} |
q267176 | Widget.getId | test | public function getId($autoGenerate = true)
{
if ($autoGenerate && $this->_id === null) {
$this->_id = static::$autoIdPrefix . $this->htmlHlp->counter++;
}
return $this->_id;
} | php | {
"resource": ""
} |
q267177 | Widget.beforeRun | test | public function beforeRun()
{
$isValid = true;
$this->emit(self::EVENT_BEFORE_RUN, [$this, &$isValid]);
return $isValid;
} | php | {
"resource": ""
} |
q267178 | Widget.checkAppPersistence | test | protected function checkAppPersistence()
{
if (!isset($this->app) || !$this->app instanceof Reaction\RequestApplicationInterface) {
$message = sprintf("You must specify \$app (RequestApplicationInterface) parameter for widget '%s'", get_called_class());
throw new Reaction\Exceptions\... | php | {
"resource": ""
} |
q267179 | Model.where | test | public static function where($field, $value, $dbConn = NULL)
{
$table = Backbone::getTable(get_called_class(), $dbConn);
if (is_null($dbConn)) {
$dbConn = Backbone::makeDbConn();
}
try {
$query = $dbConn->prepare('SELECT * FROM ' . $table . ' WHERE ' . $field . ' = ?');
$query->execute([$va... | php | {
"resource": ""
} |
q267180 | Model.destroy | test | public static function destroy($record, $dbConn = NULL)
{
$table = Backbone::getTable(get_called_class(), $dbConn);
if (is_null($dbConn)) {
$dbConn = Backbone::makeDbConn();
}
try {
$query = $dbConn->prepare('DELETE FROM ' . $table . ' WHERE id= ' . $record);
$query->execute();
} catch (PDOExcepti... | php | {
"resource": ""
} |
q267181 | Model.getAll | test | public static function getAll($dbConn = NULL)
{
$table = Backbone::getTable(get_called_class(), $dbConn);
if (is_null($dbConn)) {
$dbConn = Backbone::makeDbConn();
}
try {
$query = $dbConn->prepare('SELECT * FROM ' . $table);
$query->execute();
} catch (PDOException $e) {
return $e->getMessage(... | php | {
"resource": ""
} |
q267182 | Model.save | test | public function save($dbConn = NULL)
{
$table = Backbone::getTable(get_called_class(), $dbConn);
if (is_null($dbConn)) {
$dbConn = Backbone::makeDbConn();
}
try {
if (isset($this->record['dbData']) && is_array($this->record['dbData'])) {
$sql = 'UPDATE ' . $table . ' S... | php | {
"resource": ""
} |
q267183 | Budget.index | test | public function index()
{
//~ Breadcrumb
$this->breadcrumb->add((new BreadcrumbItem('List'))->setIcon('list')->setIsActive(true));
$get = Get::getInstance();
$params = $this->route->getParameterCollection();
$account = null;
$date = new \DateTimeImmutable(date... | php | {
"resource": ""
} |
q267184 | Budget.ajaxList | test | public function ajaxList()
{
if (!Server::getInstance()->isAjax()) {
throw new \RuntimeException();
}
$get = Get::getInstance();
$accountId = (int) $this->route->getParameterCollection()->getByName('id')->getValue();
//~ Retrieve user account / account
... | php | {
"resource": ""
} |
q267185 | Budget.verifyAccount | test | protected function verifyAccount($accountId)
{
//~ Verify if account is for current user, else throw error 500
$mapper = new AccountUserMapper(Database::get('money'));
$accountUser = $mapper->findByKeys(array('user_id' => Session::getInstance()->get('id'), 'account_id' => $accountId));
... | php | {
"resource": ""
} |
q267186 | Budget.loadNavBar | test | protected function loadNavBar()
{
$this->breadcrumb->add((new BreadcrumbItem('Budget'))
->setIcon('money')
->setUri('#'));
$bankMapper = new BankMapper(Database::get('money'));
$banks = $bankMapper->select();
$accountUserMapper = new AccountUserMapper(D... | php | {
"resource": ""
} |
q267187 | Budget.checkMonth | test | protected function checkMonth($accountId, \DateTimeImmutable $date)
{
$mapper = new BudgetMapper(Database::get('money'));
$budgetMonthMapper = new BudgetMonthMapper(Database::get('money'));
$budgetMonthMapper->check($mapper->findAllByAccountId($accountId), $date);
} | php | {
"resource": ""
} |
q267188 | PEAR_Installer_Role_Cfg.setup | test | function setup(&$installer, $pkg, $atts, $file)
{
$this->installer = &$installer;
$reg = &$this->installer->config->getRegistry();
$package = $reg->getPackage($pkg->getPackage(), $pkg->getChannel());
if ($package) {
$filelist = $package->getFilelist();
if (iss... | php | {
"resource": ""
} |
q267189 | Route.execute | test | public function execute(...$constructParameters)
{
$class = $this->class;
$method = $this->method;
$parameters = array_values($this->parameters);
$instance = new $class(...$constructParameters);
return $instance->$method(...$parameters);
} | php | {
"resource": ""
} |
q267190 | User.name | test | public function name()
{
if(isset($this->first_name) && isset($this->surname))
return $this->first_name . ' ' . $this->surname;
elseif(isset($this->first_name))
return $this->first_name;
else
return $this->user;
} | php | {
"resource": ""
} |
q267191 | User.save | test | public function save()
{
$reflection = new \ReflectionObject($this);
$properties = $reflection->getProperties(\ReflectionProperty::IS_PUBLIC);
foreach($properties as $prop)
$info[$prop->name] = $this->{$prop->name};
return $this->auth->db->update($this->auth->prefix.'user... | php | {
"resource": ""
} |
q267192 | User.changePass | test | public function changePass($old, $new1, $new2)
{
if(!$this->auth->authUser($this->user, $old))
return False;
elseif($new1 != $new2)
return False;
else
$hash = password_hash($new1, PASSWORD_BCRYPT);
return $this->auth->db->update($this->auth->pr... | php | {
"resource": ""
} |
q267193 | BindingsBuilder.give | test | public function give( $implementation )
{
$this->container->addContextualBindings( $this->concrete, $this->needs, $implementation );
} | php | {
"resource": ""
} |
q267194 | LoggerFactory.getWriter | test | protected function getWriter(ServiceLocatorInterface $serviceLocator, string $name, array $options): object
{
return $serviceLocator->getService($name, $options);
} | php | {
"resource": ""
} |
q267195 | Version.parseVersion | test | private function parseVersion()
{
if (StaticStringy::startsWith($this->versionString, 'v')) {
$this->versionString = StaticStringy::substr($this->versionString, 1);
}
if (strstr($this->versionString, '-')) {
if (sscanf(
$this->versionString,
... | php | {
"resource": ""
} |
q267196 | Version.compare | test | public function compare(VersionInterface $version)
{
if ($this->getMajorVersion() < $version->getMajorVersion()) {
return -1;
} elseif ($this->getMajorVersion() > $version->getMajorVersion()) {
return 1;
} else {
if ($this->getMinorVersion() < $version->ge... | php | {
"resource": ""
} |
q267197 | ClosureTreeBehavior.getBranch | test | public function getBranch($parentId)
{
$criteria = new CDbCriteria();
$criteria->index = 'descendantId';
$criteria->addCondition('ancestorId=:parentId AND depth=1');
$criteria->params[':parentId'] = $parentId;
$root = CActiveRecord::model($this->treeClass)->findAll($criteria)... | php | {
"resource": ""
} |
q267198 | ClosureTreeBehavior.getParent | test | public function getParent()
{
// Load the "current" level from the tree
$currentLevel = CActiveRecord::model($this->treeClass)->findByAttributes(
array('descendantId' => $this->owner->{$this->idAttribute}, 'depth' => 1)
);
if ($currentLevel->ancestorId > 0) {
... | php | {
"resource": ""
} |
q267199 | ClosureTreeBehavior.getParents | test | public function getParents($includeSelf = true)
{
$parents = array();
if ($includeSelf) {
$parents[$this->owner->{$this->idAttribute}] = $this->owner;
}
// Try and find a parent
$parent = $this->getParent();
if ($parent instanceof CActiveRecord) {
... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.