_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q235900 | PermanentObject.getSQLAdapter | train | public static function getSQLAdapter() {
$classData = null;
static::getClassData($classData);
if( !isset($classData->sqlAdapter) || !$classData->sqlAdapter ) {
$classData->sqlAdapter = SQLAdapter::getInstance(static::$DBInstance);
}
// This after $knownClassData classData
return $classData->sqlAdapter;
... | php | {
"resource": ""
} |
q235901 | OptionSet.offsetGet | train | public function offsetGet($name)
{
$name = $this->resolveAlias($name);
if (!$this->offsetExists($name))
{
return null;
}
return parent::offsetGet($name);
} | php | {
"resource": ""
} |
q235902 | OptionSet.setAlias | train | public function setAlias($aliases, $option)
{
$aliases = (array) $aliases;
foreach ($aliases as $alias)
{
$this->aliases[$alias] = $option;
}
return $this;
} | php | {
"resource": ""
} |
q235903 | OptionSet.resolveAlias | train | protected function resolveAlias($alias)
{
if (!empty($this->aliases[$alias]))
{
return $this->aliases[$alias];
}
return $alias;
} | php | {
"resource": ""
} |
q235904 | Readme.renderSections | train | public function renderSections($sections = null)
{
if ($sections === null) {
$sections = $this->getSections();
}
$res = '';
foreach ($sections as $section) {
$res .= $this->renderSection($section);
}
return $res;
} | php | {
"resource": ""
} |
q235905 | Readme.renderBadges | train | public function renderBadges()
{
$badges = $this->badges;
if (!$badges) {
return '';
}
$pm = $this->take('package')->getPackageManager();
$res = '';
foreach ($badges as $badge => $tpl) {
if (!$tpl) {
$tpl = $this->knownBadges[$b... | php | {
"resource": ""
} |
q235906 | Readme.renderBadge | train | public function renderBadge($template)
{
$tpl = $this->getTwig()->createTemplate($template);
return $tpl->render(['app' => Yii::$app]);
} | php | {
"resource": ""
} |
q235907 | Readme.getTwig | train | public function getTwig()
{
if ($this->_twig === null) {
$this->_twig = new \Twig_Environment(new \Twig_Loader_Array());
}
return $this->_twig;
} | php | {
"resource": ""
} |
q235908 | EventRegistrationDetailsEmail.factory | train | public static function factory(EventRegistration $registration) {
$email = new self();
$siteconfig = SiteConfig::current_site_config();
$email->setTo($registration->Email);
$email->setSubject(sprintf(
'Registration Details For %s (%s)',
$registration->Event()->Title,
$siteconfig->Title));
$ema... | php | {
"resource": ""
} |
q235909 | Modmgr.loadData | train | public function loadData($installModel)
{
$this->is_active = false;
$this->create_at = new Expression('NOW()'); // server time
$this->module_id = $installModel->moduleId;
$this->parent_uid = $installModel->parentUid;
$fileBody = file_get_contents($installModel->moduleClassF... | php | {
"resource": ""
} |
q235910 | Modmgr.isActive | train | protected static function isActive($dbId)
{
if (!isset(static::$_modulesData[$dbId])) {
$result = static::findOne($dbId);
static::$_modulesData[$dbId] = $result;
}
if (empty(static::$_modulesData[$dbId])) {
return false;
} else {
$isAct... | php | {
"resource": ""
} |
q235911 | Modmgr.hasUnactiveContainer | train | public function hasUnactiveContainer()
{
$parent = $this->parent_uid;
if (preg_match_all('|\{(\d+)\}|', $parent, $matches)) {
if (!empty($matches[1])) {
foreach($matches[1] as $nextDbId) {
if (!static::isActive($nextDbId)) return true;
... | php | {
"resource": ""
} |
q235912 | Modmgr.correctParents | train | public function correctParents($oldSubmodulesParentUid, $newSubmodulesParentUid)
{
if ($oldSubmodulesParentUid === $newSubmodulesParentUid) return;
$query = static::find()->where(['like', 'parent_uid', "{$oldSubmodulesParentUid}%", false]);
$list = $query->all();
foreach ($list as $... | php | {
"resource": ""
} |
q235913 | Stream.processStreamCallback | train | private function processStreamCallback(string $task, ...$params)
{
if (! isset($this->stream)) {
throw new \RuntimeException('Stream is detached');
}
$task = strtolower($task);
$fn = 'f';
if ($this->streamType === 'ZLIB') {
if ($task === 'stat') {
... | php | {
"resource": ""
} |
q235914 | CiiBaseActiveForm.checkBoxRow | train | public function checkBoxRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_CHECKBOX, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235915 | CiiBaseActiveForm.toggleButtonRow | train | public function toggleButtonRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_TOGGLEBUTTON, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235916 | CiiBaseActiveForm.checkBoxListRow | train | public function checkBoxListRow($model, $attribute, $data = array(), $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_CHECKBOXLIST, $model, $attribute, $data, $htmlOptions);
} | php | {
"resource": ""
} |
q235917 | CiiBaseActiveForm.checkBoxListInlineRow | train | public function checkBoxListInlineRow($model, $attribute, $data = array(), $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_CHECKBOXLIST_INLINE, $model, $attribute, $data, $htmlOptions);
} | php | {
"resource": ""
} |
q235918 | CiiBaseActiveForm.dropDownListRow | train | public function dropDownListRow($model, $attribute, $data = array(), $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_DROPDOWN, $model, $attribute, $data, $htmlOptions);
} | php | {
"resource": ""
} |
q235919 | CiiBaseActiveForm.fileFieldRow | train | public function fileFieldRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_FILE, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235920 | CiiBaseActiveForm.passwordFieldRow | train | public function passwordFieldRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_PASSWORD, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235921 | CiiBaseActiveForm.radioButtonRow | train | public function radioButtonRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_RADIO, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235922 | CiiBaseActiveForm.radioButtonListRow | train | public function radioButtonListRow($model, $attribute, $data = array(), $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_RADIOLIST, $model, $attribute, $data, $htmlOptions);
} | php | {
"resource": ""
} |
q235923 | CiiBaseActiveForm.radioButtonListInlineRow | train | public function radioButtonListInlineRow($model, $attribute, $data = array(), $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_RADIOLIST_INLINE, $model, $attribute, $data, $htmlOptions);
} | php | {
"resource": ""
} |
q235924 | CiiBaseActiveForm.radioButtonGroupsListRow | train | public function radioButtonGroupsListRow($model, $attribute, $data = array(), $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_RADIOBUTTONGROUPSLIST, $model, $attribute, $data, $htmlOptions);
} | php | {
"resource": ""
} |
q235925 | CiiBaseActiveForm.textFieldRow | train | public function textFieldRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_TEXT, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235926 | CiiBaseActiveForm.textAreaRow | train | public function textAreaRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_TEXTAREA, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235927 | CiiBaseActiveForm.redactorRow | train | public function redactorRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_REDACTOR, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235928 | CiiBaseActiveForm.markdownEditorRow | train | public function markdownEditorRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_MARKDOWNEDITOR, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235929 | CiiBaseActiveForm.html5EditorRow | train | public function html5EditorRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_HTML5EDITOR, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235930 | CiiBaseActiveForm.ckEditorRow | train | public function ckEditorRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_CKEDITOR, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235931 | CiiBaseActiveForm.captchaRow | train | public function captchaRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_CAPTCHA, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235932 | CiiBaseActiveForm.uneditableRow | train | public function uneditableRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_UNEDITABLE, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235933 | CiiBaseActiveForm.datepickerRow | train | public function datepickerRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_DATEPICKER, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235934 | CiiBaseActiveForm.colorpickerRow | train | public function colorpickerRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_COLORPICKER, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235935 | CiiBaseActiveForm.timepickerRow | train | public function timepickerRow($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_TIMEPICKER, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235936 | CiiBaseActiveForm.select2Row | train | public function select2Row($model, $attribute, $htmlOptions = array())
{
return $this->inputRow(CiiInput::TYPE_SELECT2, $model, $attribute, null, $htmlOptions);
} | php | {
"resource": ""
} |
q235937 | CiiBaseActiveForm.radioButtonGroupsList | train | public function radioButtonGroupsList($model, $attribute, $data, $htmlOptions = array())
{
$buttons = array();
$scripts = array();
$hiddenFieldId = CHtml::getIdByName(get_class($model) . '[' . $attribute . ']');
$buttonType = isset($htmlOptions['type']) ? $htmlOptions['type'] : null;
foreach ($data as $key... | php | {
"resource": ""
} |
q235938 | CiiBaseActiveForm.inputRow | train | public function inputRow($type, $model, $attribute, $data = null, $htmlOptions = array())
{
ob_start();
Yii::app()->controller->widget($this->getInputClassName(), array(
'type' => $type,
'form' => $this,
'model' => $model,
'attribute' => $attribute,
'data' => $data,
'htmlOptions' => $htmlOptions,... | php | {
"resource": ""
} |
q235939 | CiiBaseActiveForm.getInputClassName | train | protected function getInputClassName()
{
if (isset($this->input))
return $this->input;
else
{
switch ($this->type)
{
case self::TYPE_HORIZONTAL:
return self::INPUT_HORIZONTAL;
break;
case self::TYPE_INLINE:
return self::INPUT_INLINE;
break;
case self::TYPE_SEARCH:
... | php | {
"resource": ""
} |
q235940 | Message.send | train | public function send()
{
$settings = Application::getSettings()->mail;
$mailTransport = new Transport(
@$settings->smtp->host ? : 'localhost',
@$settings->smtp->port ? : 25,
@$settings->smtp->timeout ? : 15
);
$mailTransport->setUser(
... | php | {
"resource": ""
} |
q235941 | Input.walk | train | private function walk(callable $cb)
{
foreach($this->values() as $key => $value) {
$cb($key, $value);
}
} | php | {
"resource": ""
} |
q235942 | Mapper.setDefaultConfig | train | protected function setDefaultConfig() {
//database prefix
$this->config['db.prefix'] = '';
//dynamic sql environment id
$this->config['env.id'] = 'default';
//dynamic sql environment class
$this->config['env.class'] = 'eMapper\Dynamic\Environment\DynamicSQLEnvironment';
//default relation depth
$t... | php | {
"resource": ""
} |
q235943 | Mapper.addType | train | public function addType($type, TypeHandler $typeHandler, $alias = null) {
$this->typeManager->setTypeHandler($type, $typeHandler);
if (!is_null($alias)) {
if (is_array($alias)) {
foreach ($alias as $al)
$this->typeManager->addAlias($type, $al);
}
else
$this->typeManager->addAlias($type, $ali... | php | {
"resource": ""
} |
q235944 | Mapper.sql | train | public function sql($query, $args = []) {
if (!is_string($query) || empty($query))
throw new \InvalidArgumentException("Query is not a valid string");
//open connection
$this->driver->connect();
//build statement
$stmt = $this->driver->buildStatement($this->typeManager);
//build query
$query = ... | php | {
"resource": ""
} |
q235945 | Mapper.query | train | public function query($query) {
$args = func_get_args();
$query = array_shift($args);
return $this->execute($query, $args);
} | php | {
"resource": ""
} |
q235946 | Mapper.beginTransaction | train | public function beginTransaction() {
$this->connect();
if ($this->txStatus == self::TX_NOT_STARTED) {
$this->txStatus = self::TX_STARTED;
$this->txCounter = 1;
return $this->driver->begin();
}
$this->txCounter++;
return false;
} | php | {
"resource": ""
} |
q235947 | Mapper.commit | train | public function commit() {
if ($this->txStatus == self::TX_STARTED && $this->txCounter == 1) {
$this->txStatus = self::TX_NOT_STARTED;
$this->txCounter = 0;
return $this->driver->commit();
}
$this->txCounter--;
return false;
} | php | {
"resource": ""
} |
q235948 | Mapper.rollback | train | public function rollback() {
$this->txStatus = self::TX_NOT_STARTED;
$this->txCounter = 0;
return $this->driver->rollback();
} | php | {
"resource": ""
} |
q235949 | Mapper.newManager | train | public function newManager($classname) {
$profile = Profiler::getClassProfile($classname);
if (!$profile->isEntity())
throw new \InvalidArgumentException(sprintf("Class %s is not declared as an entity", $profile->reflectionClass->getName()));
return new Manager($this, $profile);
} | php | {
"resource": ""
} |
q235950 | OptimizeResourceTask.main | train | public function main()
{
// Get base info about project.
$this->prepareProjectData();
// Get all info about source files.
$this->getInfoSourceFiles();
// Get all info about resource files.
$this->getInfoResourceFiles();
// Prepare all place holders.
$this->preparePlaceHolders();
... | php | {
"resource": ""
} |
q235951 | OptimizeResourceTask.getClasses | train | protected function getClasses(string $phpCode): array
{
$tokens = token_get_all($phpCode);
$mode = '';
$namespace = '';
$classes = [];
foreach ($tokens as $i => $token)
{
// If this token is the namespace declaring, then flag that the next tokens will be the namespace name
... | php | {
"resource": ""
} |
q235952 | OptimizeResourceTask.getInfoSourceFiles | train | private function getInfoSourceFiles(): void
{
$this->logVerbose('Get resource files info.');
// Get the base dir of the sources.
$dir = $this->getProject()->getReference($this->sourcesFilesetId)->getDir($this->getProject());
foreach ($this->sourceFileNames as $theFileName)
{
$filename ... | php | {
"resource": ""
} |
q235953 | OptimizeResourceTask.getResourceFilesInSource | train | private function getResourceFilesInSource(string $sourceFileContent): array
{
$resource_files = [];
foreach ($this->getResourcesInfo() as $file_info)
{
if (strpos($sourceFileContent, $file_info['path_name_in_sources_with_hash'])!==false)
{
$resource_files[] = $file_info;
}
}
... | php | {
"resource": ""
} |
q235954 | ArrayCache.cache | train | public function cache($key, $value, $expire = null)
{
$this->_caches[$key] = $value;
return true;
} | php | {
"resource": ""
} |
q235955 | Gallery.handleDeleteAllImages | train | public function handleDeleteAllImages(): void
{
if ($this->request->isAjax()) {
$result = $this->getStorage()->delete();
foreach ($result as $row) {
$this->imageStorage->delete($row);
}
$this->redrawControl('gallery');
} else {
throw new AbortException;
}
} | php | {
"resource": ""
} |
q235956 | Gallery.handleDeleteImages | train | public function handleDeleteImages(string $json): void
{
if ($this->request->isAjax()) {
$data = Json::decode($json);
$result = $this->getStorage()->delete($data);
foreach ($result as $row) {
$this->imageStorage->delete($row);
}
$this->redrawControl('gallery');
} else {
throw new AbortExcep... | php | {
"resource": ""
} |
q235957 | Gallery.handleNextImage | train | public function handleNextImage(int $id): void
{
if ($this->request->isAjax()) {
$row = $this->getStorage()->getNext($id);
if ($row) {
$this->template->viewImage = $row;
$this->redrawControl('image');
} else {
throw new AbortException;
}
} else {
throw new AbortException;
}
} | php | {
"resource": ""
} |
q235958 | Gallery.handlePreviousImage | train | public function handlePreviousImage(int $id): void
{
if ($this->request->isAjax()) {
$row = $this->getStorage()->getPrevious($id);
if ($row) {
$this->template->viewImage = $row;
$this->redrawControl('image');
} else {
throw new AbortException;
}
} else {
throw new AbortException;
}
} | php | {
"resource": ""
} |
q235959 | Gallery.handleUpdatePosition | train | public function handleUpdatePosition(string $json): void
{
if ($this->request->isAjax()) {
$data = Json::decode($json);
$this->getStorage()->updatePosition($data);
}
throw new AbortException;
} | php | {
"resource": ""
} |
q235960 | Gallery.setForeignKey | train | public function setForeignKey(string $keyName, int $value): void
{
if ($this->storage instanceof NetteDatabaseStorage) {
$this->storage->setForeignKey($keyName, $value);
} elseif ($this->storage instanceof NextrasOrmStorage) {
$this->storage->setForeignKey($keyName, $value);
} else {
throw new InvalidAr... | php | {
"resource": ""
} |
q235961 | HTMLTag.addAttribute | train | public function addAttribute($name = null, $value)
{
if ($value) {
$this->attributes[$name] = $value;
}
return $this;
} | php | {
"resource": ""
} |
q235962 | HTMLTag.setClass | train | public function setClass($value)
{
$classes = [];
foreach (explode(' ', $value) as $class) {
$classes[$class] = $class;
}
$this->classes = $classes;
return $this;
} | php | {
"resource": ""
} |
q235963 | HTMLTag.Render | train | public function Render()
{
$string = $this->string;
$tag = $this->tag;
$classes = $this->classes;
if (Count($classes)) {
if ($classPrefix = $this->classPrefix) {
foreach ($classes as $key => $value) {
$prefixedClass = $classPrefix . '_... | php | {
"resource": ""
} |
q235964 | ConnectionManager.get | train | public function get($id)
{
if (isset($this->connections[$id])) {
return $this->connections[$id];
}
if (!isset($this->config[$id])) {
throw new JAQBException('No configuration or connection has been supplied for the ID "'.$id.'".');
}
$this->connectio... | php | {
"resource": ""
} |
q235965 | ConnectionManager.getDefault | train | public function getDefault()
{
// get the memoized default
if ($this->default) {
return $this->get($this->default);
}
// no configurations available
// check for existing connections
if (0 === count($this->config)) {
if (1 === count($this->con... | php | {
"resource": ""
} |
q235966 | ConnectionManager.add | train | public function add($id, QueryBuilder $connection)
{
if (isset($this->connections[$id])) {
throw new InvalidArgumentException('A connection with the ID "'.$id.'" already exists.');
}
$this->connections[$id] = $connection;
$this->default = false;
return $this;
... | php | {
"resource": ""
} |
q235967 | ConnectionManager.buildDsn | train | public function buildDsn(array $config, $id)
{
if (!isset($config['type'])) {
throw new JAQBException('Missing connection type for configuration "'.$id.'"!');
}
$dsn = $config['type'].':';
$params = [];
foreach (self::$connectionParams as $j => $k) {
... | php | {
"resource": ""
} |
q235968 | SessionManager.initializeUserSession | train | public function initializeUserSession(WebRequest $request, Response $response, User $user)
{
// If the session already has user data ...
if ($request->getSessionData('userUuid') !== false) {
$sessionToken = $request->getSessionData('userSessionToken');
$sessionTokenLifetime =... | php | {
"resource": ""
} |
q235969 | SessionManager.reinitializeSession | train | public function reinitializeSession(Framework $framework, WebRequest $request, Response $response)
{
// Sets the correct name:
session_name('ZTSM');
// Start the session
session_start();
// If the session wasn't started before, we start it now...
if ... | php | {
"resource": ""
} |
q235970 | SessionManager.logoutUser | train | public function logoutUser(WebRequest $request, Response $response)
{
$this->cleanupSession($request);
$request->removeSession();
} | php | {
"resource": ""
} |
q235971 | SessionManager.reinitializeUserSession | train | protected function reinitializeUserSession(Framework $framework, WebRequest $request, Response $response)
{
$token = $request->getSessionData('userSessionToken');
$lifetime = $request->getSessionData('userSessionTokenLifetime');
list($notValid, $token, $lifetime, $userUuid) = $this-... | php | {
"resource": ""
} |
q235972 | SessionManager.verifyToken | train | protected function verifyToken(WebRequest $request, $token, $lifetime)
{
$notValid = false;
// Cookie does not exists - this is maybe a session hijacking attack
if ($request->getCookieData($token) === false) {
$notValid = true;
}
// Check for the... | php | {
"resource": ""
} |
q235973 | SessionManager.startSession | train | protected function startSession(WebRequest $request)
{
// Save the nonce base on the session
$request->setSessionData('nonceBase', md5(uniqid()));
// Save the ip address on the session
$request->setSessionData('ipAddress', $_SERVER['REMOTE_ADDR']);
// Save t... | php | {
"resource": ""
} |
q235974 | SessionManager.cleanupSession | train | protected function cleanupSession(WebRequest $request)
{
$sessionToken = $request->getSessionData('userSessionToken');
setcookie($sessionToken, 0, time() - 60, '/', '', $request->isSsl());
$oldSessionToken = $request->getSessionData('oldUserSessionToken');
if ($oldSessionTok... | php | {
"resource": ""
} |
q235975 | SessionManager.validateSessionData | train | protected function validateSessionData(WebRequest $request)
{
if ($request->getSessionData('isObsolete') && $request->getSessionData('maxLifetime') < time()) {
return false;
}
return true;
} | php | {
"resource": ""
} |
q235976 | SessionManager.regenerateSession | train | protected function regenerateSession(WebRequest $request)
{
// Let the old session expire...
$request->setSessionData('isObsolete', true);
$request->setSessionData('maxLifetime', time() + 60);
// Regenerate the session id but don't delete the old one
session_regenera... | php | {
"resource": ""
} |
q235977 | Timer.addTimer | train | public function addTimer(Timer $timer)
{
if ( false === ($step=$this->currentStep()) ){
throw new \Exception('No current step');
}
$step->setTimer($timer);
return $this;
} | php | {
"resource": ""
} |
q235978 | Timer.addMessage | train | public function addMessage(string $message)
{
if ( false === ($step=$this->currentStep()) ){
throw new \Exception('No current step');
}
$step->addMessage($message);
return $this;
} | php | {
"resource": ""
} |
q235979 | Logs.getFile | train | public function getFile(string $id): ?FileResponse
{
$log = $this->getLog($id);
if ($log) {
$file = $log->name;
if (Strings::endsWith($file, '.html')) {
$contentType = 'text/html';
} else {
$contentType = 'text/plain';
}
return new FileResponse($this->path . $file, $file, $contentType, false... | php | {
"resource": ""
} |
q235980 | Recipients.add | train | public function add(string $email, string $name = null): void
{
$recipient = $this->make();
$recipient->email = $email;
if ($name !== null) {
$recipient->name = $name;
}
$this->set($recipient);
} | php | {
"resource": ""
} |
q235981 | HashingServiceProvider.register | train | public function register() {
// Bind the returned class to the namespace 'Ooglee\Domain\Contracts\IHashingService'
$this->app->singleton('Ooglee\Domain\Contracts\IHashingService', function($app)
{
//$hasher = $this->app['config']['ioc.app.hasher'];
$hasher = \Confi... | php | {
"resource": ""
} |
q235982 | CodeQualityTool.checkComposer | train | private function checkComposer()
{
$composerJsonDetected = false;
$composerLockDetected = false;
foreach (GitUtils::extractCommitedFiles() as $file) {
if ($file === 'composer.json') {
$composerJsonDetected = true;
}
if ($file === 'composer.... | php | {
"resource": ""
} |
q235983 | Delete.rm | train | public function rm(string $directory): bool {
if (is_dir($directory)) {
foreach (new DirectoryIterator(Path::replaceOSSeparator($directory)) as $fileInfo) {
if (!$fileInfo->isDot()) {
if ($fileInfo->isDir()) {
$this->rm($fileInfo->getPathname());
@rmdir($fileInfo->get... | php | {
"resource": ""
} |
q235984 | Controller.getLayoutPath | train | public function getLayoutPath()
{
$ref = new \ReflectionClass($this);
return dirname(dirname($ref->getFileName())) . '/views/layouts/' . $this->layout . '.php';
} | php | {
"resource": ""
} |
q235985 | Url.fromRoute | train | public function fromRoute($name, array $params = [])
{
$router = $this->getRouter();
$route = $router->get($name);
return $route->assemble($params);
} | php | {
"resource": ""
} |
q235986 | Url.absolute | train | public function absolute($relative = null)
{
$host = $this->getHost();
if (null !== $relative) {
$relative = '/' . ltrim($relative, '/');
}
return $host . $relative;
} | php | {
"resource": ""
} |
q235987 | Message.render | train | public function render ()
{
$short = !empty($this->detailed) ? "<p><strong>{$this->short}</strong></p>" : "<p>{$this->short}</p>";
$detailed = !empty($this->detailed) ? "<p>{$this->detailed}</p>" : "";
$classes = implode(' ', $this->getClasses());
return '<div class="' . $classes... | php | {
"resource": ""
} |
q235988 | CommandLocator.locate | train | public function locate($pack)
{
$finder = new Finder();
$packDirectory = $this->packs[$pack]->getDirectory();
$commandDir = $packDirectory.DIRECTORY_SEPARATOR."Command";
if (is_dir($commandDir)) {
foreach ($finder->name("*.php")->in($packDirectory.DIRECTORY_SEPARATOR."Co... | php | {
"resource": ""
} |
q235989 | JsonRenderer.stringifyBody | train | protected function stringifyBody(ResponseInterface $response): string
{
$body = $response->getBody();
if ($body === null) {
return '';
}
return json_encode($body, JSON_PARTIAL_OUTPUT_ON_ERROR);
} | php | {
"resource": ""
} |
q235990 | JsonRenderer.addHeaders | train | protected function addHeaders(ResponseInterface $response, string $body): ResponseInterface
{
return $response
->andHeader('Content-Type', 'application/json')
->andHeader('Content-Length', (string)strlen($body));
} | php | {
"resource": ""
} |
q235991 | Form.hidden | train | public function hidden($name, $value = null, $attributes = null)
{
return '<input type="hidden" name="'.$name.'" value="'.$this->getValue($name, $value).'" '.(($attributes !== null) ? $this->attributes($attributes) : "").' />';
} | php | {
"resource": ""
} |
q235992 | Form.input | train | public function input($name, $value = null, $attributes = null)
{
return '<input type="text" name="'.$name.'" value="'.$this->getValue($name, $value).'" '.(($attributes !== null) ? $this->attributes($attributes) : "").'/>';
} | php | {
"resource": ""
} |
q235993 | Form.password | train | public function password($name, $value = null, $attributes = null)
{
return '<input type="password" name="'.$name.'" value="'.$this->getValue($name, $value).'" '.(($attributes !== null) ? $this->attributes($attributes) : "").'/>';
} | php | {
"resource": ""
} |
q235994 | Form.submit | train | public function submit($name, $value = null, $attributes = null)
{
return '<input type="submit" name="'.$name.'" '.(($attributes !== null) ? $this->attributes($attributes) : "").' value="'.$this->getValue($name, $value).'" />';
} | php | {
"resource": ""
} |
q235995 | CategoryController.actionIndex | train | public function actionIndex()
{
$query = ArticleCategory::find()->orderBy(['sort' => SORT_ASC]);
$dataProvider = new ActiveDataProvider([
'query' => $query,
'pagination' => false
]);
return $this->render('index', [
'dataProvider' => $dataProvider,
... | php | {
"resource": ""
} |
q235996 | GroupRepository.findOneByRole | train | public function findOneByRole($role)
{
$qb = $this->createQueryBuilder('g');
return $qb
->andWhere($qb->expr()->like('g.roles', $qb->expr()->literal('%"'.strtoupper($role).'"%')))
->orderBy('g.position', 'DESC')
->setMaxResults(1)
->getQuery()
... | php | {
"resource": ""
} |
q235997 | ArrayCache.exists | train | public function exists($key) {
if (!array_key_exists($key, $this->storage))
return false;
if ($this->storage[$key]['expires'] > 0 && time() > $this->storage[$key]['expires'])
return false;
return true;
} | php | {
"resource": ""
} |
q235998 | ConfigurationTrait.getConfig | train | public function getConfig()
{
if ($this->configuration) {
return $this->configuration;
}
$dir = APP_DIR . DS . 'Resource' . DS . 'migrations';
$migrationTable = 'phinxlog';
if ($bundleName = $this->input->getOption('bundle')) {
$dir = Bundles::getPat... | php | {
"resource": ""
} |
q235999 | PostObject.image | train | public static function image($itemId, $size)
{
if(has_post_thumbnail($itemId))
{
return wp_get_attachment_image_src(
get_post_thumbnail_id($itemId), $size
)[0];
}
return false;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.