_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q5800 | RepositoryMakeCommand.getMethods | train | protected function getMethods()
{
if ($this->option('plain')) {
return [];
}
$methods = ['all', 'find', 'create', 'update', 'delete'];
if (($only = $this->option('only')) && $only != '') {
$methods = array_flip(array_only(array_flip($methods), $this->getArra... | php | {
"resource": ""
} |
q5801 | RepositoryMakeCommand.getArray | train | protected function getArray($values)
{
$values = explode(',', $values);
array_walk($values, function (&$value) {
$value = trim($value);
});
return $values;
} | php | {
"resource": ""
} |
q5802 | RepositoryMakeCommand.compileFileName | train | protected function compileFileName($className)
{
if (!$className) {
return false;
}
$className = str_replace($this->getAppNamespace(), '', $className);
$className = str_replace('\\', DIRECTORY_SEPARATOR, $className);
return $className . '.php';
} | php | {
"resource": ""
} |
q5803 | RepositoryMakeCommand.getContractName | train | protected function getContractName()
{
if (!$this->input->getOption('contract')) {
return false;
}
$className = $this->getClassName();
return $this->getContractNamespace() . '\\' . $className;
} | php | {
"resource": ""
} |
q5804 | RepositoryMakeCommand.getRepositoryName | train | protected function getRepositoryName()
{
$prefix = $this->getClassNamePrefix();
$name = $this->getClassName();
if ($this->input->getOption('contract')) {
$name = $prefix . $name;
}
return $this->getNamespace() . '\\' . $name;
} | php | {
"resource": ""
} |
q5805 | RepositoryMakeCommand.getClassNamePrefix | train | protected function getClassNamePrefix()
{
$prefix = $this->input->getOption('prefix');
if (empty($prefix)) {
$prefix = $this->classNamePrefix;
}
return $prefix;
} | php | {
"resource": ""
} |
q5806 | RepositoryMakeCommand.getClassNameSuffix | train | protected function getClassNameSuffix()
{
$suffix = $this->input->getOption('suffix');
if (empty($suffix)) {
$suffix = $this->classNameSuffix;
}
return $suffix;
} | php | {
"resource": ""
} |
q5807 | RepositoryMakeCommand.getModelReflection | train | protected function getModelReflection()
{
$modelClassName = str_replace('/', '\\', $this->input->getArgument('model'));
try {
$reflection = new ReflectionClass($this->getAppNamespace() . $modelClassName);
} catch (\ReflectionException $e) {
$reflection = new Reflecti... | php | {
"resource": ""
} |
q5808 | RepositoryMakeCommand.getNamespace | train | protected function getNamespace($namespace = null)
{
if (!is_null($namespace)) {
$parts = explode('\\', $namespace);
array_pop($parts);
return join('\\', $parts);
}
return $this->getAppNamespace() . $this->namespace;
} | php | {
"resource": ""
} |
q5809 | UserSubscriber.submit | train | public function submit(FormEvent $event)
{
$user = $event->getData();
if (null === $user) {
return;
}
if ($this->currentUser !== null && $this->currentUser !== $user && $event->getForm()->has('activated')) {
$activated = $event->getForm()->get('activated')->ge... | php | {
"resource": ""
} |
q5810 | UserSubscriber.preSetData | train | public function preSetData(FormEvent $event)
{
$user = $event->getData();
if (null === $user) {
return;
}
if($this->currentUser !== null && $this->currentUser !== $user) {
$event->getForm()->add($this->factory->createNamed('activated', 'checkbox', null, array(... | php | {
"resource": ""
} |
q5811 | ServerManager.server | train | public function server($name = null)
{
if (empty($name)) {
$name = $this->getDefaultServerName();
}
if (!isset($this->servers[$name])) {
$this->servers[$name] = $this->makeServer($name);
}
return $this->servers[$name];
} | php | {
"resource": ""
} |
q5812 | ServerManager.makeServer | train | protected function makeServer($name)
{
$config = $this->getConfig($name);
if (empty($config)) {
throw new \InvalidArgumentException("Unable to instantiate Glide server because you provide en empty configuration, \"{$name}\" is probably a wrong server name.");
}
if (arra... | php | {
"resource": ""
} |
q5813 | HelpController.listCommand | train | public function listCommand()
{
$this->console->writeLn('manaphp commands:', Console::FC_GREEN | Console::AT_BOLD);
foreach (glob(__DIR__ . '/*Controller.php') as $file) {
$plainName = basename($file, '.php');
if (in_array($plainName, ['BashCompletionController', 'HelpControl... | php | {
"resource": ""
} |
q5814 | CreateSourceBackboneFactory.getInstance | train | public static function getInstance(ContextInterface $context)
{
return new CreateSourceBackbone(
MetadataSourceQuestionFactory::getInstance($context),
MetaDataConfigDAOFactory::getInstance($context),
$context
);
} | php | {
"resource": ""
} |
q5815 | TaskController.listCommand | train | public function listCommand()
{
$this->console->writeLn('tasks list:');
$tasks = [];
$tasksDir = $this->alias->resolve('@app/Tasks');
if (is_dir($tasksDir)) {
foreach (glob("$tasksDir/*Task.php") as $file) {
$task = basename($file, 'Task.php');
... | php | {
"resource": ""
} |
q5816 | VendorResources.isVendorClass | train | public static function isVendorClass($classNameOrObject)
{
$className = (is_object($classNameOrObject)) ? get_class($classNameOrObject) : $classNameOrObject;
if (!class_exists($className)) {
$message = '"' . $className . '" is not the name of a loadable class.';
throw new \I... | php | {
"resource": ""
} |
q5817 | VendorResources.isVendorFile | train | public static function isVendorFile($pathOrFileObject)
{
$path = ($pathOrFileObject instanceof \SplFileInfo) ? $pathOrFileObject->getPathname() : $pathOrFileObject;
if (!file_exists($path)) {
$message = '"' . $path . '" does not reference a file or directory.';
throw new \Inv... | php | {
"resource": ""
} |
q5818 | PaymentMethodCode.code | train | public static function code($constant)
{
$ref = new \ReflectionClass('\PayPay\Structure\PaymentMethodCode');
$constants = $ref->getConstants();
if (!isset($constants[$constant])) {
throw new \InvalidArgumentException("Invalid payment method code constant " . $constant);
}... | php | {
"resource": ""
} |
q5819 | CssToXPath._transform | train | protected function _transform($path_src)
{
$path = (string)$path_src;
if (strpos($path, ',') !== false) {
$paths = explode(',', $path);
$expressions = [];
foreach ($paths as $path) {
$xpath = $this->transform(trim($path));
if (is_s... | php | {
"resource": ""
} |
q5820 | CssToXPath._tokenize | train | protected static function _tokenize($expression_src)
{
// Child selectors
$expression = str_replace('>', '/', $expression_src);
// IDs
$expression = preg_replace('|#([a-z][a-z0-9_-]*)|i', "[@id='$1']", $expression);
$expression = preg_replace('|(?<![a-z0-9_-])(\[@id=)|i', '*... | php | {
"resource": ""
} |
q5821 | ConfigurationMenuProvider.sortItems | train | protected function sortItems(&$items)
{
$this->safeUaSortItems($items, function ($item1, $item2) {
if (empty($item1['order']) || empty($item2['order']) || $item1['order'] == $item2['order']) {
return 0;
}
return ($item1['order'] < $item2['order']) ? -1 : ... | php | {
"resource": ""
} |
q5822 | ConfigurationMenuProvider.isGranted | train | protected function isGranted(array $configuration)
{
// If no role configuration. Grant rights.
if (!isset($configuration['roles'])) {
return true;
}
// If no configuration. Grant rights.
if (!is_array($configuration['roles'])) {
return true;
... | php | {
"resource": ""
} |
q5823 | RemoteShell.process | train | protected function process()
{
$output = "";
$offset = 0;
$this->shell->_initShell();
while( true ) {
$temp = $this->shell->_get_channel_packet(SSH2::CHANNEL_EXEC);
switch( true ) {
case $temp === true:
case $temp === false:
... | php | {
"resource": ""
} |
q5824 | KeyController.generateCommand | train | public function generateCommand($length = 32, $lowercase = 0)
{
$key = $this->random->getBase($length);
$this->console->writeLn($lowercase ? strtolower($key) : $key);
} | php | {
"resource": ""
} |
q5825 | Grid.addColumn | train | public final function addColumn(Column\ColumnAbstract $column)
{
//dodawanie Columnu (nazwa unikalna)
return $this->_columns[$column->getName()] = $column->setGrid($this);
} | php | {
"resource": ""
} |
q5826 | MessageRepository.countUnread | train | public function countUnread(User $user)
{
return $this->createQueryBuilder('m')
->select('count(m)')
->join('m.userMessages', 'um')
->where('m.user != :sender')
->orWhere('m.user IS NULL')
->andWhere('um.user = :user')
->andWhere('um.is... | php | {
"resource": ""
} |
q5827 | CmsFileQuery.imagesByObject | train | public static function imagesByObject($object = null, $objectId = null)
{
//zapytanie po obiekcie
return self::byObject($object, $objectId)
->whereClass()->equals('image');
} | php | {
"resource": ""
} |
q5828 | CmsFileQuery.stickyByObject | train | public static function stickyByObject($object = null, $objectId = null, $class = null)
{
//zapytanie po obiekcie
$q = self::byObject($object, $objectId)
->whereSticky()->equals(1);
//dodawanie klasy jeśli wyspecyfikowana
if (null !== $class) {
$q->andField... | php | {
"resource": ""
} |
q5829 | CmsFileQuery.notImagesByObject | train | public static function notImagesByObject($object = null, $objectId = null)
{
//zapytanie po obiekcie i id
return self::byObject($object, $objectId)
->whereClass()->notEquals('image');
} | php | {
"resource": ""
} |
q5830 | HashManager.option | train | public function option($option = null)
{
if ( ! is_null($option)) {
$this->option = $option;
$this->buildDrivers();
}
return $this;
} | php | {
"resource": ""
} |
q5831 | HashManager.buildDrivers | train | private function buildDrivers()
{
$drivers = $this->getHasherConfig('drivers', []);
foreach ($drivers as $name => $driver) {
$this->buildDriver($name, $driver);
}
} | php | {
"resource": ""
} |
q5832 | HashManager.buildDriver | train | private function buildDriver($name, array $driver)
{
return $this->drivers[$name] = new $driver['driver'](
Arr::get($driver, 'options.'.$this->getDefaultOption(), [])
);
} | php | {
"resource": ""
} |
q5833 | FrameworkController.minifyCommand | train | public function minifyCommand()
{
$ManaPHPSrcDir = $this->alias->get('@manaphp');
$ManaPHPDstDir = $ManaPHPSrcDir . '_' . date('ymd');
$totalClassLines = 0;
$totalInterfaceLines = 0;
$totalLines = 0;
$fileLines = [];
$sourceFiles = $this->_getSourceFiles($Mana... | php | {
"resource": ""
} |
q5834 | FrameworkController.genJsonCommand | train | public function genJsonCommand($source)
{
$classNames = [];
/** @noinspection ForeachSourceInspection */
/** @noinspection PhpIncludeInspection */
foreach (require $source as $className) {
if (preg_match('#^ManaPHP\\\\.*$#', $className)) {
$classNames[] = ... | php | {
"resource": ""
} |
q5835 | TaggedServiceIterator.getIterator | train | public function getIterator()
{
$tagsById = $this->container->findTaggedServiceIds($this->tag);
$taggedServices = array();
foreach ($tagsById as $id => $tagDefinitions) {
/* @var $id string */
/* @var $tagDefinitions array(array(string=>string)) */
f... | php | {
"resource": ""
} |
q5836 | OperationColumn.addCustomButton | train | public function addCustomButton($iconName, array $params = [], $hashTarget = '')
{
$customButtons = is_array($this->getOption('customButtons')) ? $this->getOption('customButtons') : [];
$customButtons[] = ['iconName' => $iconName, 'params' => $params, 'hashTarget' => $hashTarget];
return $th... | php | {
"resource": ""
} |
q5837 | MetaDataColumn.getName | train | public function getName($ucfirst = false)
{
$value = $this->camelCase($this->name);
if (true === $ucfirst) {
return ucfirst($value);
} else {
return $value;
}
} | php | {
"resource": ""
} |
q5838 | Request.getFiles | train | public function getFiles($onlySuccessful = true)
{
$context = $this->_context;
$files = [];
/** @var $_FILES array */
foreach ($context->_FILES as $key => $file) {
if (is_int($file['error'])) {
if (!$onlySuccessful || $file['error'] === UPLOAD_ERR_OK) {
... | php | {
"resource": ""
} |
q5839 | Contact.beforeSave | train | public function beforeSave()
{
$this->getRecord()->active = 0;
$this->getRecord()->cmsAuthIdReply = \App\Registry::$auth->getId();
return true;
} | php | {
"resource": ""
} |
q5840 | Session.destroy | train | public function destroy($session_id = null)
{
if ($session_id) {
$this->eventsManager->fireEvent('session:destroy', $this, ['session_id' => $session_id]);
$this->do_destroy($session_id);
} else {
$context = $this->_context;
if (!$context->started) {
... | php | {
"resource": ""
} |
q5841 | Session.get | train | public function get($name = null, $default = null)
{
$context = $this->_context;
if (!$context->started) {
$this->_start();
}
if ($name === null) {
return $context->_SESSION;
} elseif (isset($context->_SESSION[$name])) {
return $context->... | php | {
"resource": ""
} |
q5842 | Session.set | train | public function set($name, $value)
{
$context = $this->_context;
if (!$context->started) {
$this->_start();
}
$context->is_dirty = true;
$context->_SESSION[$name] = $value;
} | php | {
"resource": ""
} |
q5843 | Session.has | train | public function has($name)
{
$context = $this->_context;
if (!$context->started) {
$this->_start();
}
return isset($context->_SESSION[$name]);
} | php | {
"resource": ""
} |
q5844 | Session.remove | train | public function remove($name)
{
$context = $this->_context;
if (!$context->started) {
$this->_start();
}
$context->is_dirty = true;
unset($context->_SESSION[$name]);
} | php | {
"resource": ""
} |
q5845 | Ma27ApiKeyAuthenticationExtension.loadCore | train | private function loadCore(ContainerBuilder $container, Loader\YamlFileLoader $loader, $config)
{
$isCacheEnabled = $config['metadata_cache'];
$container->setParameter('ma27_api_key_authentication.model_name', $config['model_name']);
$container->setParameter('ma27_api_key_authentication.obje... | php | {
"resource": ""
} |
q5846 | Ma27ApiKeyAuthenticationExtension.loadPassword | train | private function loadPassword(ContainerBuilder $container, $passwordConfig, Loader\YamlFileLoader $loader)
{
$container->setParameter('ma27_api_key_authentication.password_hashing_service', $passwordConfig['strategy']);
$container->setParameter('ma27_api_key_authentication.password_hasher.phpass.ite... | php | {
"resource": ""
} |
q5847 | Ma27ApiKeyAuthenticationExtension.loadServices | train | private function loadServices(Loader\YamlFileLoader $loader)
{
foreach (array('security_key', 'authentication', 'security', 'annotation') as $file) {
$loader->load(sprintf('%s.yml', $file));
}
} | php | {
"resource": ""
} |
q5848 | Ma27ApiKeyAuthenticationExtension.loadApiKeyPurger | train | private function loadApiKeyPurger(ContainerBuilder $container, Loader\YamlFileLoader $loader, array $purgerConfig)
{
$container->setParameter('ma27_api_key_authentication.cleanup_command.date_time_rule', $purgerConfig['outdated_rule']);
$loader->load('session_cleanup.yml');
if ($this->isCon... | php | {
"resource": ""
} |
q5849 | Ma27ApiKeyAuthenticationExtension.overrideServices | train | private function overrideServices(ContainerBuilder $container, array $services)
{
$serviceConfig = array(
'auth_handler' => 'ma27_api_key_authentication.auth_handler',
'key_factory' => 'ma27_api_key_authentication.key_factory',
);
foreach ($serviceConfig as $configI... | php | {
"resource": ""
} |
q5850 | Text.text | train | public function text($key)
{
return nl2br(\Cms\Model\Text::textByKeyLang($key, \Mmi\App\FrontController::getInstance()->getView()->request->lang));
} | php | {
"resource": ""
} |
q5851 | SettingsParser.getSites | train | public function getSites()
{
$sites = [];
$defaultSet = false;
if (!$this->getValid()) {
return $sites;
}
foreach ($this->xml->children() as $child) {
if ($child->getName() == "site") {
$site = $this->parseSite($child);
... | php | {
"resource": ""
} |
q5852 | SettingsParser.getStaticTokens | train | public function getStaticTokens()
{
$tokens = [];
$sites = [];
if (!$this->getValid()) {
return $sites;
}
foreach ($this->xml->children() as $child) {
if ($child->getName() == "token") {
$token = $this->parseToken($child);
... | php | {
"resource": ""
} |
q5853 | AclManager.setObjectACL | train | public function setObjectACL($entity, $aces, $type)
{
if ($type != "object") {
throw new \RuntimeException('ACEs of type ' . $type . ' are not supported.');
}
$acl = $this->getAcl($entity);
$oldAces = $acl->getObjectAces();
// Delete old ACEs
foreach... | php | {
"resource": ""
} |
q5854 | AclManager.getACL | train | public function getACL($entity, $create = true)
{
$acl = null;
$oid = $this->getEntityObjectId($entity);
try {
$acl = $this->aclProvider->findAcl($oid);
} catch (NotAllAclsFoundException $e) {
$acl = $e->getPartialResult();
} catch (AclNotFoundExceptio... | php | {
"resource": ""
} |
q5855 | TinyMce._modeSimple | train | protected function _modeSimple()
{
if ($this->getToolbars() === null) {
$this->setToolbars('bold italic underline strikethrough | alignleft aligncenter alignright alignjustify');
}
if ($this->getContextMenu() === null) {
$this->setContextMenu('link image inserttable |... | php | {
"resource": ""
} |
q5856 | TinyMce._modeAdvanced | train | protected function _modeAdvanced()
{
if ($this->getToolbars() === null) {
$this->setToolbars([
'undo redo | cut copy paste pastetext | searchreplace | bold italic underline strikethrough | subscript superscript | alignleft aligncenter alignright alignjustify | fontselect fontsize... | php | {
"resource": ""
} |
q5857 | TinyMce._modeDefault | train | protected function _modeDefault()
{
if ($this->getToolbars() === null) {
$this->setToolbars('undo redo | bold italic underline strikethrough | forecolor backcolor | styleselect | bullist numlist outdent indent | fontselect fontsizeselect | alignleft aligncenter alignright alignjustify | link unl... | php | {
"resource": ""
} |
q5858 | CmsTextQuery.lang | train | public static function lang()
{
if (!\Mmi\App\FrontController::getInstance()->getRequest()->lang) {
return new self;
}
return (new self)
->whereLang()->equals(\Mmi\App\FrontController::getInstance()->getRequest()->lang)
->orFieldLang()->equals(null... | php | {
"resource": ""
} |
q5859 | Dispatcher.getParam | train | public function getParam($name, $default = null)
{
$params = $this->_context->params;
return isset($params[$name]) ? $params[$name] : $default;
} | php | {
"resource": ""
} |
q5860 | Dispatcher.dispatch | train | public function dispatch($router)
{
$context = $this->_context;
if ($router instanceof RouterContext) {
$area = $router->area;
$controller = $router->controller;
$action = $router->action;
$params = $router->params;
} else {
$area ... | php | {
"resource": ""
} |
q5861 | Secint.encode | train | public function encode($id, $type = '')
{
if (!isset($this->_keys[$type])) {
if ($this->_key === null) {
$this->_key = $this->crypt->getDerivedKey('secint');
}
$this->_keys[$type] = md5($this->_key . $type, true);
}
while (true) {
... | php | {
"resource": ""
} |
q5862 | Secint.decode | train | public function decode($hash, $type = '')
{
if (strlen($hash) !== 11) {
return false;
}
if (!isset($this->_keys[$type])) {
if ($this->_key === null) {
$this->_key = $this->crypt->getDerivedKey('secint');
}
$this->_keys[$type] ... | php | {
"resource": ""
} |
q5863 | WallPosterExtension.getConfigurationDirectory | train | protected function getConfigurationDirectory()
{
$reflector = new \ReflectionClass($this);
$fileName = $reflector->getFileName();
if (!is_dir($directory = dirname($fileName) . $this->configDirectory)) {
throw new \RuntimeException(sprintf('The configuration directory "%s" does n... | php | {
"resource": ""
} |
q5864 | UserAjax.postCreate | train | public function postCreate()
{
$response = array(
"method" => "create",
"success" => false,
"user" => "",
"error_code" => 0,
"error_message" => ""
);
try {
AuthorizerHelper::can(UserValidator::USER_CAN_SAVE);
$data = json_decode(file_get_contents("php://input"));
if... | php | {
"resource": ""
} |
q5865 | ResponseCreationListener.onResponseCreation | train | public function onResponseCreation(OnAssembleResponseEvent $event)
{
if ($event->isSuccess()) {
$event->setResponse(new JsonResponse(array(
$this->apiKeyValue => $this->metadata->getPropertyValue($event->getUser(), ClassMetadata::API_KEY_PROPERTY),
)));
r... | php | {
"resource": ""
} |
q5866 | Node.fromRawEntry | train | public static function fromRawEntry($entry)
{
$className = get_called_class();
$class = new $className();
foreach ($entry as $property=> $value)
$class->{$property} = $value;
return $class;
} | php | {
"resource": ""
} |
q5867 | ParseNode.abs_end | train | function abs_end(){
$Node = $this;
while( $Child = end( $Node->children ) ){
$Node = $Child;
}
return $Node;
} | php | {
"resource": ""
} |
q5868 | ParseNode.abs_pop | train | function abs_pop(){
$Node = $this->abs_end();
if( is_null($Node->pidx) ){
// cannot pop self from self
return false;
}
// pop node from it's parent
return $Node->get_parent()->pop();
} | php | {
"resource": ""
} |
q5869 | ParseNode.terminate | train | function terminate( $tok ){
if( is_scalar($tok) ){
// scalar token e.g. ";"
if( is_null($this->t) ){
$this->t = $tok;
}
$this->value = $tok;
}
else if( is_array($tok) ){
// PHP tokenizer style array token
$this->t = $tok[0];
$this->value = $tok[1];
// store additional info in terminal ... | php | {
"resource": ""
} |
q5870 | ParseNode.get_child | train | function get_child( $i ){
return isset($this->children[$i]) ? $this->children[$i] : null;
} | php | {
"resource": ""
} |
q5871 | ParseNode.get_line_num | train | function get_line_num(){
if( ! isset($this->l) ){
if( isset($this->children[0]) ){
$this->l = $this->children[0]->get_line_num();
}
else {
$this->l = 0;
}
}
return $this->l;
} | php | {
"resource": ""
} |
q5872 | ParseNode.get_col_num | train | function get_col_num(){
if( ! isset($this->c) ){
if( isset($this->children[0]) ){
$this->c = $this->children[0]->get_col_num();
}
else {
$this->c = 0;
}
}
return $this->c;
} | php | {
"resource": ""
} |
q5873 | ParseNode.push | train | function push( ParseNode $Node, $recursion = true ){
if( $Node->pidx ){
trigger_error("Node $Node->idx already has parent $Node->pidx", E_USER_WARNING );
}
// Resolve recursion on the fly if required
if( $this->t === $Node->t && $Node->length ){
// allow node's own setting to override parameter
if( iss... | php | {
"resource": ""
} |
q5874 | ParseNode.push_thru | train | function push_thru( ParseNode $Node ){
foreach( $Node->children as $Child ){
$Node->remove( $Child );
$this->push( $Child );
}
return $this->length;
} | php | {
"resource": ""
} |
q5875 | ParseNode.pop | train | function pop(){
if( ! $this->length ){
return null;
}
if( --$this->length <= 0 ){
$this->length = 0;
$this->p = null;
}
else {
$this->p = 0;
}
$Node = array_pop( $this->children );
$Node->pidx = null;
$Node->depth = 0;
return $Node;
} | php | {
"resource": ""
} |
q5876 | ParseNode.remove | train | function remove( ParseNode $Node ){
foreach( $this->children as $i => $Child ){
if( $Child->idx === $Node->idx ){
return $this->remove_at( $i );
}
}
} | php | {
"resource": ""
} |
q5877 | ParseNode.remove_at | train | function remove_at( $i ){
$Child = $this->children[$i];
$Child->pidx = null;
$Child->depth = 0;
array_splice( $this->children, $i, 1 );
if( ! --$this->length ){
$this->p = null;
}
else {
$this->p = 0;
}
return $Child;
} | php | {
"resource": ""
} |
q5878 | ParseNode.splice | train | function splice( ParseNode $Node, array $nodes ){
foreach( $this->children as $i => $Child ){
if( $Child->idx === $Node->idx ){
return $this->splice_at( $i, $nodes, 1 );
}
}
} | php | {
"resource": ""
} |
q5879 | ParseNode.splice_at | train | function splice_at( $i, array $nodes, $len = 0){
$Child = $this->children[$i];
$Child->pidx = null;
$Child->depth = 0;
array_splice( $this->children, $i, $len, $nodes );
foreach( $nodes as $Node ){
$Node->pidx = $this->idx;
}
$this->length = count( $this->children );
$this->p = 0;
return $Child;
} | php | {
"resource": ""
} |
q5880 | ParseNode.get_parent | train | function get_parent(){
if( !is_null($this->pidx) && isset(self::$reg[$this->pidx]) ){
return self::$reg[$this->pidx];
}
else {
return null;
}
} | php | {
"resource": ""
} |
q5881 | ParseNode.export | train | function export(){
if( $this->is_terminal() ){
if( $this->t === $this->value ){
// scalar token
return $this->value;
}
// PHP Tokenizer style array
return array( $this->t, $this->value );
}
// else is a branch
$a = array();
foreach( $this->children as $Child ){
$a[] = array( $this->t, $... | php | {
"resource": ""
} |
q5882 | ParseNode.dump | train | function dump( Lex $Lex, $tab = '' ){
$tag = $Lex->name( $this->t );
if( $this->is_terminal() ){
if( $this->value && $this->value !== $this->t ){
echo $tab, '<',$tag,">\n ", $tab, htmlspecialchars($this->value),"\n",$tab,'</',$tag,">\n";
}
else {
echo $tab, htmlspecialchars($this->value),"\n";
... | php | {
"resource": ""
} |
q5883 | Setup.run | train | public static function run(Event $event)
{
$event->getIO()->write('<info>Now running setup tasks...</info>');
$config = static::getConfig($event);
$tasks = static::getSetupTasks($event);
foreach ($tasks as $task) {
/** @var SetupTask $taskStep */
$taskStep = ... | php | {
"resource": ""
} |
q5884 | Setup.getSetupTasks | train | protected static function getSetupTasks(Event $event)
{
return [
AskAboutProjectParameters::class,
VerifyProjectParameters::class,
RemoveExistingRootFiles::class,
ReplacePlaceholdersInTemplateFiles::class,
MoveTemplateFilesToRootFolder::class,
... | php | {
"resource": ""
} |
q5885 | Sharing.update | train | public function update(int $vehicleId, int $sharingId, ?string $description, ?string $duration = '1D'): Response
{
$this->requiresAccessToken();
return $this->sendJson(
'PATCH',
"vehicles/{$vehicleId}/sharing/{$sharingId}",
$this->getApiHeaders(),
$th... | php | {
"resource": ""
} |
q5886 | Sharing.destroy | train | public function destroy(int $vehicleId, int $sharingId): Response
{
$this->requiresAccessToken();
return $this->send(
'DELETE',
"vehicles/{$vehicleId}/sharing/{$sharingId}",
$this->getApiHeaders()
);
} | php | {
"resource": ""
} |
q5887 | modelMS.conn | train | protected function conn($db_config_name = '')
{
$db_config_name = $db_config_name ? $db_config_name : $this->db_config_name;
if (! isset(self::$_db_handle[$db_config_name])) {
if (true == C('sql_log')) {
wlog('SQL-Log', '#'.$db_config_name);
}
$dbd... | php | {
"resource": ""
} |
q5888 | RelationshipExtension.processNoDataRelationship | train | protected function processNoDataRelationship($source, DocumentHydrator $hydrator): NoDataRelationship
{
$relationship = new NoDataRelationship();
$hydrator->hydrateObject($relationship, $source);
return $relationship;
} | php | {
"resource": ""
} |
q5889 | RelationshipExtension.processSingleIdentifierRelationship | train | protected function processSingleIdentifierRelationship($source, DocumentHydrator $hydrator): SingleIdentifierRelationship
{
$identifier = $this->createResourceIdentifier($source->data, $hydrator);
$relationship = new SingleIdentifierRelationship($identifier);
$hydrator->hydrateObject($rel... | php | {
"resource": ""
} |
q5890 | RelationshipExtension.processIdentifierCollectionRelationship | train | protected function processIdentifierCollectionRelationship($source, DocumentHydrator $hydrator): IdentifierCollectionRelationship
{
$relationship = new IdentifierCollectionRelationship();
foreach ($source->data as $resourceSrc)
{
$relationship->addIdentifier($this->createResourc... | php | {
"resource": ""
} |
q5891 | GuzzleAdapter.createException | train | protected function createException(GuzzleRequestException $exception): RequestException
{
if ($exception instanceof GuzzleResponseException) {
return new ResponseException(
$exception->getRequest(),
$exception->getResponse(),
$exception
... | php | {
"resource": ""
} |
q5892 | MetadataContainer.setMetadataAttribute | train | public function setMetadataAttribute(string $name, $value)
{
if (array_key_exists($name, $this->metadata)) {
throw new MetadataAttributeOverrideException($this, $name);
}
$this->metadata[$name] = $value;
} | php | {
"resource": ""
} |
q5893 | MetadataContainer.getMetadataAttribute | train | public function getMetadataAttribute(string $name)
{
if (array_key_exists($name, $this->metadata)) {
return $this->metadata[$name];
}
throw new MetadataAttributeNotFoundException($this, $name);
} | php | {
"resource": ""
} |
q5894 | Webservice.setup | train | public function setup()
{
//====================================================================//
// Read Parameters
$this->id = Splash::configuration()->WsIdentifier;
$this->key = Splash::configuration()->WsEncryptionKey;
//=================================================... | php | {
"resource": ""
} |
q5895 | Webservice.pack | train | public function pack($data, $isUncrypted = false)
{
//====================================================================//
// Debug Log
Splash::log()->deb('MsgWsPack');
//====================================================================//
// Encode Data Buffer
/... | php | {
"resource": ""
} |
q5896 | Webservice.unPack | train | public function unPack($data, $isUncrypted = false)
{
//====================================================================//
// Debug Log
Splash::log()->deb('MsgWsunPack');
//====================================================================//
// Decrypt response
... | php | {
"resource": ""
} |
q5897 | Webservice.call | train | public function call($service, $tasks = null, $isUncrypted = false, $clean = true)
{
//====================================================================//
// WebService Call =>> Initialisation
if (!$this->init($service)) {
return false;
}
//====================... | php | {
"resource": ""
} |
q5898 | Webservice.simulate | train | public function simulate($service, $tasks = null, $isUncrypted = false, $clean = true)
{
//====================================================================//
// WebService Call =>> Initialisation
if (!$this->init($service)) {
return false;
}
//================... | php | {
"resource": ""
} |
q5899 | Webservice.addTask | train | public function addTask($name, $params, $desc = 'No Description')
{
//====================================================================//
// Create a new task
$task = new ArrayObject(array(), ArrayObject::ARRAY_AS_PROPS);
//=========================================================... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.