_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q239900 | TabHelper.createTab | train | public function createTab($name, $label, $options = array())
{
$options = array_replace(
$options,
array(
'label' => $label,
'inherit_data' => true,
));
$tab = $this->formBuilder->create($name, TabsTabType::class, $options);
... | php | {
"resource": ""
} |
q239901 | BaseController.render | train | public function render($content, Response $response)
{
$response->setStatusCode(Response::HTTP_OK);
$response->headers->set('Content-Type', 'application/json');
$response->setContent(json_encode($content));
return $response;
} | php | {
"resource": ""
} |
q239902 | Session.Start | train | public static function Start($sName, $sSessionDiretory = null){
$oThis = self::CreateInstanceIfNotExists();
if(!empty($sName)){
$sName = md5($sName);
if(!is_null($sSessionDiretory)){
@session_save_path($sSessionDiretory);
... | php | {
"resource": ""
} |
q239903 | Session.Login | train | public static function Login($mId, $sUsername, $sName, $iTimeout = 3600, $bRoot = false){
$oThis = self::CreateInstanceIfNotExists();
if($oThis->bStarted){
$iTimeout = time()+$iTimeout;
$oThis->aAuth = array("id" => $mId, "name" => $sName, "username" => $sUsernam... | php | {
"resource": ""
} |
q239904 | Session.Logout | train | public static function Logout(){
$oThis = self::CreateInstanceIfNotExists();
if($oThis->bStarted){
session_unset();
unset($_SESSION[$oThis->sName]["authentication"]);
unset($oThis->aAuth);
}
} | php | {
"resource": ""
} |
q239905 | Session.CheckAuthentication | train | public static function CheckAuthentication(){
$oThis = self::CreateInstanceIfNotExists();
$bReturn = ($oThis->bStarted) ? (!empty($oThis->aAuth["id"]) && !empty($oThis->aAuth["username"]) && ((intval($oThis->aAuth["timeout"]) > time()) || (intval($oThis->aAuth["timeout"]) <= 0))) : false;
... | php | {
"resource": ""
} |
q239906 | Session.Has | train | public static function Has($sKey){
$oThis = self::CreateInstanceIfNotExists();
if($oThis->bStarted)
return array_key_exists($sKey, $_SESSION[$oThis->sName]);
else
return false;
} | php | {
"resource": ""
} |
q239907 | Session.Set | train | public static function Set($sKey, $mValue){
$oThis = self::CreateInstanceIfNotExists();
if($oThis->bStarted){
if($sKey != "name" && $sKey != "id" && $sKey != "authentication"){
$_SESSION[$oThis->sName][$sKey] = $mValue;
return true;
... | php | {
"resource": ""
} |
q239908 | Session.Get | train | public static function Get($sKey){
$oThis = self::CreateInstanceIfNotExists();
if($oThis->bStarted)
return (!empty($_SESSION[$oThis->sName][$sKey])) ? $_SESSION[$oThis->sName][$sKey] : false;
else
return null;
} | php | {
"resource": ""
} |
q239909 | Cache.forge | train | public static function forge($identifier, $config = array())
{
// load the default config
$defaults = \Config::get('cache', array());
// $config can be either an array of config settings or the name of the storage driver
if ( ! empty($config) and ! is_array($config) and ! is_null($config))
{
$config = ar... | php | {
"resource": ""
} |
q239910 | Router.route | train | public function route()
{
$this->routes->rewind();
while ($this->routes->valid()) {
$route = $this->routes->current();
if ($route->run()) {
return;
}
$this->routes->next();
}
throw new \RuntimeException("FlexPress route... | php | {
"resource": ""
} |
q239911 | Router.replaceFilterFunctions | train | protected function replaceFilterFunctions(array $conditions)
{
foreach ($conditions as $key => $condition) {
if (is_string($condition)) {
$conditions[$key] = $this->filters[$condition];
}
}
return $conditions;
} | php | {
"resource": ""
} |
q239912 | Theme.resolveList | train | public static function resolveList($renderKey, $stopClass = null, $type = null)
{
$viewListList = static::resolve($renderKey, $stopClass, $type);
$finalList = [];
foreach($viewListList as $theme => $viewList)
{
foreach($viewList as $view)
{
if(is_array($view))
{
$finalList = array_merge($fi... | php | {
"resource": ""
} |
q239913 | Theme.resolveFirst | train | public static function resolveFirst($renderKey, $stopClass = null, $type = null)
{
$viewListList = static::resolve($renderKey, $stopClass, $type);
$viewList = current($viewListList);
if(!$viewList)
{
return;
}
$view = current($viewList);
return $view;
} | php | {
"resource": ""
} |
q239914 | Theme.render | train | public static function render($object, array $vars = [], $type = null)
{
if($view = static::resolveFirst($object, null, $type))
{
return new $view(['object' => $object] + $vars);
}
} | php | {
"resource": ""
} |
q239915 | Theme.wrap | train | public static function wrap($body, $vars = [])
{
if(isset(static::$wrap))
{
if($body instanceof \SeanMorris\Theme\View)
{
$body = $body->render();
}
foreach(static::$wrap as $wrapper)
{
$body = new $wrapper(['body' => $body] + $vars);
}
}
return $body;
} | php | {
"resource": ""
} |
q239916 | Theme.selectType | train | protected static function selectType($views, $type)
{
if(!is_array($views))
{
return $views;
}
if($type === FALSE)
{
return $views;
}
if(!$type)
{
return current($views);
}
if(!isset($views[$type]))
{
return null;
}
return $views[$type];
} | php | {
"resource": ""
} |
q239917 | Statement.supportFilter | train | protected function supportFilter( array $list = [], bool $enable = true ) {
foreach( $list as $type ) {
if( !$enable ) unset( $this->_filter[ $type ] );
else if( !isset( $this->_filter[ $type ] ) ) $this->_filter[ $type ] = [];
}
return $this;
} | php | {
"resource": ""
} |
q239918 | Statement.supportCustom | train | protected function supportCustom( array $list = [], bool $enable = true ) {
foreach( $list as $name ) {
if( !$enable ) unset( $this->_custom[ $name ] );
else if( !isset( $this->_custom[ $name ] ) ) $this->_custom[ $name ] = [];
}
return $this;
} | php | {
"resource": ""
} |
q239919 | Conversion.setAdapter | train | public function setAdapter($adapter)
{
if (!is_string($adapter) && !$adapter instanceof ConversionAlgorithmInterface) {
throw new Exception\InvalidArgumentException(sprintf(
'"%s" expects a string or an instance of ConversionAlgorithmInterface; received "%s"',
__M... | php | {
"resource": ""
} |
q239920 | Conversion.getAdapter | train | public function getAdapter()
{
if (!$this->adapter) {
throw new Exception\RuntimeException(sprintf(
'"%s" unable to load adapter; adapter not found',
__METHOD__
));
}
if (method_exists($this->adapter, 'setOptions')) {
$this-... | php | {
"resource": ""
} |
q239921 | Conversion.setAdapterOptions | train | public function setAdapterOptions($options)
{
if (!is_array($options) && !$options instanceof AbstractOptions) {
throw new Exception\InvalidArgumentException(sprintf(
'"%s" expects an array or a valid instance of "%s"; received "%s"',
__METHOD__,
'... | php | {
"resource": ""
} |
q239922 | Conversion.getAbstractOptions | train | protected function getAbstractOptions()
{
$optClass = self::getOptionsFullQualifiedClassName($this->adapter);
// Does the option class exist?
if (!class_exists($optClass)) {
throw new Exception\DomainException(
sprintf(
'"%s" expects that an op... | php | {
"resource": ""
} |
q239923 | Conversion.getOptions | train | public function getOptions($option = null)
{
$this->getAdapterOptions();
if ($option !== null) {
if (!isset($this->options[$option])) {
throw new Exception\RuntimeException(sprintf(
'Options "%s" not found',
$option
... | php | {
"resource": ""
} |
q239924 | Conversion.getOptionsFullQualifiedClassName | train | public static function getOptionsFullQualifiedClassName($adapter)
{
if (!$adapter) {
throw new Exception\InvalidArgumentException(sprintf(
'"%s" unable to load adapter; adapter not found',
__METHOD__
));
}
if (!$adapter instanceof Conve... | php | {
"resource": ""
} |
q239925 | FormCompletenessChecker.isComplete | train | public static function isComplete(Form $form)
{
//Set the return value to true by default
$ret = true;
//Foreach child of the form
foreach($form->all() as $child) {
//If the child is required, check that its set
if ($child->isRequired()) {
if ... | php | {
"resource": ""
} |
q239926 | KoineString.at | train | public function at($start = null, $length = null)
{
return new self(mb_substr((string) $this, $start, $length, 'UTF-8'));
} | php | {
"resource": ""
} |
q239927 | Zend_Http_Response_Stream.fromStream | train | public static function fromStream($response_str, $stream)
{
$code = self::extractCode($response_str);
$headers = self::extractHeaders($response_str);
$version = self::extractVersion($response_str);
$message = self::extractMessage($response_str);
return new self($code, $he... | php | {
"resource": ""
} |
q239928 | Zend_Http_Response_Stream.readStream | train | protected function readStream()
{
if(!is_resource($this->stream)) {
return '';
}
if(isset($headers['content-length'])) {
$this->body = stream_get_contents($this->stream, $headers['content-length']);
} else {
$this->body = stream_get_contents($this... | php | {
"resource": ""
} |
q239929 | RolesController.listAction | train | public function listAction()
{
$roleHierarchy = $this->container->getParameter('security.role_hierarchy.roles');
$roles = [];
foreach (array_keys($roleHierarchy) as $role) {
$roles[] = ['id' => $role, 'name' => $role];
}
return new JsonResponse($roles);
} | php | {
"resource": ""
} |
q239930 | Ini.loadFile | train | public function loadFile($pFile, $pParseKeys = false)
{
$this->_content = parse_ini_file($pFile, true);
if ($pParseKeys) {
$this->_parseKeys($this->_content);
}
return $this;
} | php | {
"resource": ""
} |
q239931 | SDK.create | train | public static function create(
AuthInterface $authentication,
bool $throwsExceptions = false,
string $baseUrl = 'https://api.idos.io/1.0/'
) : self {
return new static(
$authentication,
new Client(),
$throwsExceptions,
$baseUrl
... | php | {
"resource": ""
} |
q239932 | SDK.getEndpointClassName | train | protected function getEndpointClassName(string $name) : string {
$className = sprintf(
'%s\\%s\\%s',
'idOS',
'Endpoint',
ucfirst($name)
);
if (! class_exists($className)) {
throw new \RuntimeException(
sprintf(
... | php | {
"resource": ""
} |
q239933 | AdminConfigurationBuilder.addSection | train | public function addSection($name, $label, $position=0)
{
$sectionManager = $this->container->get('admin.configuration.configsection_manager');
$section = $sectionManager->getRepository()->findOneByName($name);
if (!$section) {
$section = new ConfigSection();
$section-... | php | {
"resource": ""
} |
q239934 | AdminConfigurationBuilder.addGroup | train | public function addGroup($sectionName, $name, $label, $position=0)
{
$groupManager = $this->container->get('admin.configuration.configgroup_manager');
$sectionManager = $this->container->get('admin.configuration.configsection_manager');
$group = $groupManager->getRepository()->findOneBySecti... | php | {
"resource": ""
} |
q239935 | AdminConfigurationBuilder.addType | train | public function addType($identifier, $label, $formType, $options = array())
{
$typeManager = $this->container->get('admin.configuration.configtype_manager');
$type = $typeManager->getRepository()->findOneByIdentifier($identifier);
if (!$type) {
$type = new ConfigType();
... | php | {
"resource": ""
} |
q239936 | Store.getUploadProgress | train | final public static function getUploadProgress($formName)
{
$key = ini_get("session.upload_progress.prefix") . $formName;
if (!empty($_SESSION[$key])) {
$current = $_SESSION[$key]["bytes_processed"];
$total = $_SESSION[$key]["content_length"];
return $current < $... | php | {
"resource": ""
} |
q239937 | Store.start | train | final public function start($killPrevious = FALSE)
{
//starts this session if not creates a new one
//$self = (!isset($this) || !is_a($this, "Library\Session")) ? self::getInstance() : $this;
//@TODO Check if there is an existing session!
//If there is any previous and killprevious ... | php | {
"resource": ""
} |
q239938 | Store.getSplash | train | final public function getSplash()
{
$userIp = md5($this->input->serialize($this->input->getVar('REMOTE_ADDR', \IS\STRING, '', 'server')));
$userAgent = md5($this->input->serialize($this->input->getVar('HTTP_USER_AGENT', \IS\STRING, '', 'server')));
$userDomain = md5($this->input->serialize(... | php | {
"resource": ""
} |
q239939 | Store.create | train | final public function create()
{
$self = $this;
$splash = $self->getSplash();
$sessId = $this->generateId($splash);
session_id($sessId); //Must be called before the sesion start to generate the Id
session_cache_limiter('none');
session_name(md5($self->cookie . $sp... | php | {
"resource": ""
} |
q239940 | Store.getAuthority | train | final public function getAuthority()
{
$self = $this;
$auth = $self->get("handler", "auth");
//$authority = \Platform\Authorize::getInstance();
if (is_a($auth, Authenticate::class)) {
if (isset($auth->authenticated)) {
//Read Rights if we have a userId
... | php | {
"resource": ""
} |
q239941 | Store.isAuthenticated | train | final public function isAuthenticated()
{
$self = $this;
$auth = $self->get("handler", "auth");
if (is_a($auth, Authenticate::class)) {
if (isset($auth->authenticated)) {
return (bool)$auth->authenticated;
}
}
return false;
} | php | {
"resource": ""
} |
q239942 | Store.generateId | train | final public function generateId($splash)
{
$encryptor = $this->encryptor;
$input = $this->input;
$sessId = md5($encryptor->getKey() . $input->serialize($splash));
return $sessId;
} | php | {
"resource": ""
} |
q239943 | Store.read | train | final public function read($id = Null)
{
$self = $this;
$input = $this->input;
$uri = $this->uri;
//$dbo = Database::getInstance();
$splash = $self->getSplash();
//Do we have a cookie?
$sessCookie = md5($self->cookie . $splash['agent'] . $splash['ip'] . $s... | php | {
"resource": ""
} |
q239944 | Store.update | train | final public function update($sessId, $userdata = array())
{
if (empty($sessId)) {
return false;
}
$self = $this;
//updates a started session for exp time
//stores data for the registry
$now = time();
$newExpires = $now + $self->life;
$... | php | {
"resource": ""
} |
q239945 | Store.restart | train | final public function restart()
{
$id = $this->getId();
$this->destroy($id);
$this->create();
$this->gc();
} | php | {
"resource": ""
} |
q239946 | Store.destroy | train | final public function destroy($id = "")
{
$id = !empty($id) ? $id : $this->getId();
$now = time();
if (empty($id)) {
return false;
}
setcookie(session_name(), '', $now - 42000, '/');
if (session_id()) {
@session_unset();
@sessio... | php | {
"resource": ""
} |
q239947 | Store.write | train | final public function write($sessId, $data = array())
{
//Writes user data to the db;
$self = $this;
//expires
$expires = time() + $self->life;
//Sets the cookie
//$output->setCookie($self->cookie, $sessId."0".$data['token'], $expires);
//$output->setCookie... | php | {
"resource": ""
} |
q239948 | Store.lock | train | final public function lock($namespace)
{
//locks a namespace in this session to prevent editing
if (empty($namespace)) {
//@TODO throw an exception,
//we don't know what namespace this is
return false;
}
$session = $this;
//unlocks a namesp... | php | {
"resource": ""
} |
q239949 | Store.isLocked | train | final public function isLocked($namespace)
{
if (empty($namespace)) {
return true; //just say its locked
}
//checks if a namespace in this session is locked
$session = $this;
//unlocks a namespace
if (isset($session->registry[$namespace])) {
... | php | {
"resource": ""
} |
q239950 | Store.get | train | final public function get($varname, $namespace = 'default')
{
//gets a registry var, stored in a namespace of this session id
$session = $this;
if (!isset($namespace) || empty($namespace)) {
//@TODO Throw an exception, we need a name or use the default;
return false;... | php | {
"resource": ""
} |
q239951 | Store.set | train | final public function set($varname, $value = NULL, $namespace = 'default')
{
//stores a value to a varname in a namespace of this session
$session = $this;
if (!isset($namespace) || empty($namespace)) {
//@TODO Throw an exception, we need a name or use the default;
t... | php | {
"resource": ""
} |
q239952 | Store.remove | train | final public function remove($varname = '', $namespace = 'default')
{
//if the registry is empty and the namespace is not default
//delete the registry;
//stores a value to a varname in a namespace of this session
$session = $this;
//echo $namespace;
//@TODO, check ... | php | {
"resource": ""
} |
q239953 | LanguagesController.copyFallbackTranslations | train | private function copyFallbackTranslations($newLocale)
{
\DB::transaction(function () use ($newLocale) {
$existingTranslations = Translation::get();
$fallbackLanguage = Language::whereIsFallback(1)->first();
if ($fallbackLanguage) {
$fallbackIsoCode = $fa... | php | {
"resource": ""
} |
q239954 | UrlResolver.getContentTypePageUrl | train | public function getContentTypePageUrl(ContentTypePage $page, ContentInterface $document)
{
return $this->router->generate(
$this->getRouteName($page),
$this->getRoutingParamaters($page, $document)
);
} | php | {
"resource": ""
} |
q239955 | Client.slReseplanerare2Trip | train | public function slReseplanerare2Trip($originId, $destId, array $options = []) {
$params = [
'key' => $this->slReseplanerare2key,
'originId' => $originId,
'destId' => $destId
];
$params = array_merge($params, $options);
$url = $this->SlReseplanerare2UR... | php | {
"resource": ""
} |
q239956 | Client.slReseplanerare2Geometry | train | public function slReseplanerare2Geometry($ref) {
$url = $this->SlReseplanerare2URL.'/geometry.json';
$params = [
'key' => $this->slReseplanerare2key,
'ref' => $ref
];
$request = $this->client->request('GET', $url, [
'query' => $params
]);
... | php | {
"resource": ""
} |
q239957 | Client.slReseplanerare2JourneyDetail | train | public function slReseplanerare2JourneyDetail($ref) {
$url = $this->SlReseplanerare2URL.'/journeydetail.json';
$params = [
'key' => $this->slReseplanerare2key,
'ref' => $ref
];
$request = $this->client->request('GET', $url, [
'query' => $params
... | php | {
"resource": ""
} |
q239958 | BHTML.out_head | train | public function out_head(){
$this->frameworks_process();
if($this->lazyload){
$this->lazyload_prepare();
}
//Outputing
$tab=' ';
echo($tab.'<title>'.$this->title.'</title>'.PHP_EOL);
if(!empty($this->link_canonical)){
echo($tab.'<link rel="canonical" href="'.$this->link_canonical.'" />'.PHP_EOL);
... | php | {
"resource": ""
} |
q239959 | Psr3ErrorHandler.getLevel | train | private function getLevel(\Throwable $t, array $context): string
{
// Check if the severity matches a PSR-3 log level
if (
false === $this->ignoreSeverity &&
isset($context[Context::SEVERITY]) &&
is_string($context[Context::SEVERITY]) &&
$this->validat... | php | {
"resource": ""
} |
q239960 | Database.buildQuery | train | public function buildQuery( $table_name, $type, $params = null )
{
if ( $type == "find" )
{
$sub_sql = isset($params["sub_sql"]) ? $params["sub_sql"] : null;
$sql = "SELECT * FROM $table_name";
if ( isset($sub_sql) )
{
... | php | {
"resource": ""
} |
q239961 | ParametersTrait.getParam | train | public function getParam($key, $default = null)
{
if (isset($this->parameters[$key])) {
return $this->parameters[$key];
}
return $default;
} | php | {
"resource": ""
} |
q239962 | LinkController.recurseLinkNodes | train | private function recurseLinkNodes(array $nodes, $language, $mode, TreeNodeInterface $targetNode = null)
{
$elementService = $this->get('phlexible_element.element_service');
$iconResolver = $this->get('phlexible_element.icon_resolver');
$data = [];
foreach ($nodes as $node) {
... | php | {
"resource": ""
} |
q239963 | LinkController.recursiveTreeStrip | train | private function recursiveTreeStrip(array $data)
{
if (count($data) === 1 && !empty($data[0]['children'])) {
return $this->recursiveTreeStrip($data[0]['children']);
}
return $data;
} | php | {
"resource": ""
} |
q239964 | CategoriesControllerCategories.getModel | train | public function getModel($name = 'Category', $prefix = 'CategoriesModel', $config = array('ignore_request' => true))
{
return parent::getModel($name, $prefix, $config);
} | php | {
"resource": ""
} |
q239965 | CategoriesControllerCategories.rebuild | train | public function rebuild()
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
$extension = $this->input->get('extension');
$this->setRedirect(JRoute::_('index.php?option=com_categories&view=categories&extension=' . $extension, false));
/** @var CategoriesModelCategory $model */
$model = $this->g... | php | {
"resource": ""
} |
q239966 | CategoriesControllerCategories.saveorder | train | public function saveorder()
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
JLog::add('CategoriesControllerCategories::saveorder() is deprecated. Function will be removed in 4.0', JLog::WARNING, 'deprecated');
// Get the arrays from the Request
$order = $this->input->post->get('order', null, '... | php | {
"resource": ""
} |
q239967 | CategoriesControllerCategories.delete | train | public function delete()
{
JSession::checkToken() or jexit(JText::_('JINVALID_TOKEN'));
// Get items to remove from the request.
$cid = $this->input->get('cid', array(), 'array');
$extension = $this->input->getCmd('extension', null);
if (!is_array($cid) || count($cid) < 1)
{
JError::raiseWarning(500, ... | php | {
"resource": ""
} |
q239968 | CategoriesControllerCategories.checkin | train | public function checkin()
{
// Process parent checkin method.
$result = parent::checkin();
// Overrride the redirect Uri.
$redirectUri = 'index.php?option=' . $this->option . '&view=' . $this->view_list . '&extension=' . $this->input->get('extension', '', 'CMD');
$this->setRedirect(JRoute::_($redirectUri, f... | php | {
"resource": ""
} |
q239969 | Plugin.parsePropertyFile | train | public function parsePropertyFile(BuildInterface $build, $fileName)
{
$activeProperty = false;
$trimNextLine = false;
$arr = array();
$fh = fopen($fileName, 'r');
if (is_resource($fh)) {
while ($line = fgets($fh)) {
if (preg_match('/^[!#].*/', $lin... | php | {
"resource": ""
} |
q239970 | Restful._customRequest | train | protected function _customRequest($url, $data, $type)
{
$response = $this->curl->init($this->url ?? $url)
->option('returntransfer', true)
->option('customrequest', strtoupper($type))
->option('ssl_verifypeer', $this->sslVerifyPeer)
... | php | {
"resource": ""
} |
q239971 | DbTableGateway.gc | train | public function gc($maxlifetime)
{
$platform = $this->tableGateway->getAdapter()->getPlatform();
$where = new Where();
$where->lessThan(
$this->options->getModifiedColumn(),
new Expression('(' . time() . ' - ' . $platform->quoteIdentifier($this->options->getLifetimeC... | php | {
"resource": ""
} |
q239972 | UserRepository.save | train | public function save(User $user) : bool
{
if (!$user->save()) {
throw new \RuntimeException($this->i18n->t('setrun/user', 'Saving error'));
}
return true;
} | php | {
"resource": ""
} |
q239973 | UserRepository.remove | train | public function remove(User $user) : bool
{
if (!$user->delete()) {
throw new \RuntimeException($this->i18n->t('setrun/user', 'Removing error'));
}
return true;
} | php | {
"resource": ""
} |
q239974 | UserRepository.getBy | train | public function getBy(array $condition) : User
{
if (!$user = User::find()->andWhere($condition)->limit(1)->one()) {
throw new NotFoundException($this->i18n->t('setrun/user', 'User not found'));
}
return $user;
} | php | {
"resource": ""
} |
q239975 | View.load | train | private static function load($path)
{
$path = str_replace('.', '/', $path);
$path = FULL_PATH . $path;
if(substr($path, -4) != '.php')
{
$path = $path . '.php';
}
return $path;
} | php | {
"resource": ""
} |
q239976 | View.get | train | public static function get($file, $data = [])
{
$path = self::load('views.' . $file);
extract($data, EXTR_SKIP);
include $path;
} | php | {
"resource": ""
} |
q239977 | View.parse | train | private static function parse($file, $data)
{
$file = file_get_contents($file, FILE_USE_INCLUDE_PATH);
// Go through each variable and replace the values
foreach($data as $key => $value)
{
$pattern = '{{{' . $key . '}}}';
$file = preg_replace($pattern, $value... | php | {
"resource": ""
} |
q239978 | BufferOverflowException.setOverflowMagnitude | train | public function setOverflowMagnitude($magnitude)
{
if ($magnitude < 0) {
throw new \LogicException('Overflow magnitude cannot be negative.');
}
if (!is_numeric($magnitude)) {
throw new \InvalidArgumentException('Overflow magnitude should be a number.');
}
... | php | {
"resource": ""
} |
q239979 | AbstractConfig.getFilepath | train | public function getFilepath()
{
if (isset($this->dirPath)) {
$filepath = $this->dirPath .'/'.$this->filename;
} else {
$fileSystem = $this->createNew(FileSystem::class);
$filepath = $fileSystem->getCurrentWorkingDirectory() .'/'.$this->filename;
}
... | php | {
"resource": ""
} |
q239980 | AbstractConfig.validateConfig | train | public function validateConfig(array $rules, array $configData)
{
$validator = $this->createNew(Validator::class);
if ($validator->isValid($rules, $configData) == false) {
throw new DataValidationException('The config is invalid: ' . print_r($validator->getErrors(), 1));
... | php | {
"resource": ""
} |
q239981 | AbstractConfig.open | train | public function open()
{
$fileSystem = $this->createNew(FileSystem::class);
$filepath = $this->getFilepath();
$contents = $fileSystem->fileGetContents($filepath);
$this->configData = json_decode($contents, true);
if (isset($this->configData) == false) {
throw ... | php | {
"resource": ""
} |
q239982 | AbstractConfig.save | train | public function save()
{
$filepath = $this->getFilepath();
$this->validateConfig($this->rules, $this->configData);
$fileSystem = $this->createNew(FileSystem::class);
$fileSystem->filePutContents($filepath, json_encode($this->configData, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES));
... | php | {
"resource": ""
} |
q239983 | YouTubeStreamsLoader.getStreams | train | public function getStreams($channelId = null)
{
if (!$channelId) {
$channelId = $this->channelId;
}
if (!$channelId) {
throw new MissingChannelIdException("You must specify the channel id");
}
if ($this->cache) {
$data = $this->cache->fet... | php | {
"resource": ""
} |
q239984 | Config.get | train | public static function get($file, $key = false, $force = false)
{
$item = self::read($file, $force);
if($item === false)
{
return false;
}
if($key != false && isset($item[$key]))
{
return $item[$key];
}
return $item;
} | php | {
"resource": ""
} |
q239985 | JoinFacade.inner | train | public function inner($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->inner($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | php | {
"resource": ""
} |
q239986 | JoinFacade.left | train | public function left($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->left($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | php | {
"resource": ""
} |
q239987 | JoinFacade.right | train | public function right($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->right($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | php | {
"resource": ""
} |
q239988 | JoinFacade.leftOuter | train | public function leftOuter($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->leftOuter($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | php | {
"resource": ""
} |
q239989 | JoinFacade.rightOuter | train | public function rightOuter($table, array $optionalTables = array())
{
$preparedTablesArray = $this->_getPreparedTableObjects($table, $optionalTables);
$this->join->rightOuter($preparedTablesArray['table'], $preparedTablesArray['optionalTables']);
return $this;
} | php | {
"resource": ""
} |
q239990 | JoinFacade._getPreparedTableObjects | train | private function _getPreparedTableObjects($table, array $optionalTables)
{
$tableObj = $this->factory->references('Table', $table);
$optionalTablesObj = array();
foreach($optionalTables as $tbl)
{
$optionalTablesObj[] = $this->factory->references('Table', $tbl);
}
return array('table' => $tabl... | php | {
"resource": ""
} |
q239991 | JoinFacade._checkOnArguments | train | private function _checkOnArguments(array $firstColumn, array $secondColumn)
{
if(!array_key_exists('column', $firstColumn) || !array_key_exists('table', $firstColumn) ||
!array_key_exists('column', $secondColumn) || !array_key_exists('table', $secondColumn)
)
{
throw new \InvalidArgumentException('Both a... | php | {
"resource": ""
} |
q239992 | Kernel.createEach | train | protected function createEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_get($data, 'instance')) {
$instance = $this->getProviderInvoker()
->create($class, $this->getSharedArguments());
array_set($data, 'instance', $instance)... | php | {
"resource": ""
} |
q239993 | Kernel.configureEach | train | protected function configureEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_contains(array_get($data, 'tags'), ProviderTag::CONFIGURED)) {
$this->create();
array_add($data, 'tags', ProviderTag::CONFIGURED);
$instance = array_get... | php | {
"resource": ""
} |
q239994 | Kernel.initializeEach | train | protected function initializeEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_contains(array_get($data, 'tags'), ProviderTag::INITIALIZED)) {
$this->configure();
array_add($data, 'tags', ProviderTag::INITIALIZED);
$instance = arr... | php | {
"resource": ""
} |
q239995 | Kernel.bootEach | train | protected function bootEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_contains(array_get($data, 'tags'), ProviderTag::BOOTED)) {
$this->initialize();
array_add($data, 'tags', ProviderTag::BOOTED);
$instance = array_get($data, '... | php | {
"resource": ""
} |
q239996 | Kernel.shutdownEach | train | protected function shutdownEach() {
foreach ($this->providers as $class => &$data) {
if ( ! array_contains(array_get($data, 'tags'), ProviderTag::SHUTDOWN)) {
$this->boot();
array_add($data, 'tags', ProviderTag::SHUTDOWN);
$instance = array_get($data,... | php | {
"resource": ""
} |
q239997 | MessageAdapter.add | train | public function add($message, $code, $type)
{
$default = ['message' => $message, 'code' => $code, 'type' => $type];
if ($type == 'error' && is_numeric($code) && $code >= 0) {
$default['descriptor'] = array_search($code, $this->codes['codes']);
}
if ($this->domain !== self... | php | {
"resource": ""
} |
q239998 | DbManagementTable.populate | train | public function populate(DbManagement $db, DbManagementObject $DbManagementObject, $query)
{
$keys = array_values($DbManagementObject->getKeys());
$db->add($query, $keys);
$array = array_values($DbManagementObject->getValues());
$db->query($query, $array);
return $db... | php | {
"resource": ""
} |
q239999 | DbManagementTable.getData | train | public function getData(DbManagement $db, $query, $params, DbManagementObject $DbManagementObject)
{
$keys = $DbManagementObject->getKeys();
//parse params to check their validity and
//use the conventions to sort and filter results
$parsed = $this->parseParams($params, $key... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.