_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q262100 | Dispatcher.invokeAction | test | private function invokeAction($object, $method, array $arguments)
{
$methodInfo = $this->reflectionFactory->getMethod(
get_class($object), $method
);
$parameters = $methodInfo->getParameters();
$values = array();
$total = count($parameters);
for ($i = 0; $... | php | {
"resource": ""
} |
q262101 | TcpPeer.hasActivity | test | public function hasActivity()
{
if (!$this->isConnected()) {
return false;
}
$read = array($this->socket);
$write = null;
$ex = null;
$result = socket_select($read, $write, $ex, 0, 0);
if ($result === false) {
throw new TcpException(
... | php | {
"resource": ""
} |
q262102 | ContainerImpl.getBeanDefinition | test | public function getBeanDefinition($name)
{
if (isset($this->_beanAliases[$name])) {
$name = $this->_beanAliases[$name];
}
if (isset($this->_beanDefs[$name])) {
return $this->_beanDefs[$name];
}
$beanDefinition = null;
if ($this->_beanDefCache !... | php | {
"resource": ""
} |
q262103 | ContainerImpl._searchAndReplaceProperties | test | private function _searchAndReplaceProperties($value)
{
if (is_string($value)) {
foreach ($this->_properties as $k => $v) {
if (strpos($value, $k) !== false) {
if (is_string($v)) {
$value = str_replace($k, $v, $value);
... | php | {
"resource": ""
} |
q262104 | ContainerImpl._getConstructorValuesForDefinition | test | private function _getConstructorValuesForDefinition($definition)
{
$args = array();
foreach ($definition->getArguments() as $argument) {
$value = $this->_getValueFromDefinition($argument);
if ($argument->hasName()) {
$name = $argument->getName();
... | php | {
"resource": ""
} |
q262105 | ContainerImpl._instantiateByConstructor | test | private function _instantiateByConstructor(BeanDefinition $definition)
{
$class = $definition->getClass();
if ($definition->hasProxyClass()) {
$class = $definition->getProxyClassName();
}
$rClass = $this->_reflectionFactory->getClass($class);
$factoryMethod = $rCl... | php | {
"resource": ""
} |
q262106 | ContainerImpl._instantiateByFactoryClass | test | private function _instantiateByFactoryClass(BeanDefinition $definition)
{
$class = $definition->getClass();
$rClass = $this->_reflectionFactory->getClass($class);
$factoryMethodName = $definition->getFactoryMethod();
$factoryMethod = $rClass->getMethod($factoryMethodName);
$a... | php | {
"resource": ""
} |
q262107 | ContainerImpl._instantiateByFactoryBean | test | private function _instantiateByFactoryBean(BeanDefinition $definition)
{
$factoryBean = $this->getBean($definition->getFactoryBean());
$refObject = new \ReflectionObject($factoryBean);
$factoryMethod = $refObject->getMethod($definition->getFactoryMethod());
$args = $this->_sortArgsWi... | php | {
"resource": ""
} |
q262108 | ContainerImpl._instantiate | test | private function _instantiate(BeanDefinition $definition)
{
if ($definition->isCreatedByConstructor()) {
return $this->_instantiateByConstructor($definition);
} else if ($definition->isCreatedWithFactoryBean()) {
return $this->_instantiateByFactoryBean($definition);
}... | php | {
"resource": ""
} |
q262109 | ContainerImpl._createBeanDependencies | test | private function _createBeanDependencies(BeanDefinition $definition)
{
foreach ($definition->getDependsOn() as $depBean) {
$this->getBean(trim($depBean));
}
} | php | {
"resource": ""
} |
q262110 | ContainerImpl._applyAspect | test | private function _applyAspect(
$targetClass, AspectDefinition $aspectDefinition, IDispatcher $dispatcher
) {
$rClass = $this->_reflectionFactory->getClass($targetClass);
$aspect = $this->getBean($aspectDefinition->getBeanName());
foreach ($aspectDefinition->getPointcuts() as $pointcu... | php | {
"resource": ""
} |
q262111 | ContainerImpl._applySpecificAspects | test | private function _applySpecificAspects(BeanDefinition $definition, IDispatcher $dispatcher)
{
if ($definition->hasAspects()) {
foreach ($definition->getAspects() as $aspect) {
$this->_applyAspect($definition->getClass(), $aspect, $dispatcher);
}
}
} | php | {
"resource": ""
} |
q262112 | ContainerImpl._applyGlobalAspects | test | private function _applyGlobalAspects(BeanDefinition $definition, IDispatcher $dispatcher)
{
$class = $definition->getClass();
$rClass = $this->_reflectionFactory->getClass($class);
foreach ($this->_aspectManager->getAspects() as $aspect) {
$expression = $aspect->getExpression();
... | php | {
"resource": ""
} |
q262113 | ContainerImpl._applyAspects | test | private function _applyAspects(BeanDefinition $definition)
{
$class = $definition->getClass();
$dispatcher = clone $this->_dispatcherTemplate;
$this->_applySpecificAspects($definition, $dispatcher);
$this->_applyGlobalAspects($definition, $dispatcher);
if ($dispatcher->hasMet... | php | {
"resource": ""
} |
q262114 | ContainerImpl._createBean | test | private function _createBean(BeanDefinition $definition)
{
$name = $definition->getName();
if (isset($this->_definitionsInProcess[$name])) {
throw new BeanFactoryException(
"Cyclic dependency found for: $name"
);
}
$this->_definitionsInProcess[$na... | php | {
"resource": ""
} |
q262115 | ContainerImpl._setupInitAndShutdown | test | private function _setupInitAndShutdown($bean, BeanDefinition $definition)
{
if ($definition->hasInitMethod()) {
$initMethod = $definition->getInitMethod();
$bean->$initMethod();
}
if ($definition->hasDestroyMethod()) {
$destroyMethod = $definition->getDest... | php | {
"resource": ""
} |
q262116 | ContainerImpl._nonSetterMethodInject | test | private function _nonSetterMethodInject($bean, $name, $value)
{
$rClass = $this->_reflectionFactory->getClass(get_class($bean));
if ($rClass->hasMethod($name)) {
$bean->$name($value);
return true;
}
return false;
} | php | {
"resource": ""
} |
q262117 | ContainerImpl._propertyInject | test | private function _propertyInject($bean, $name, $value)
{
$rClass = $this->_reflectionFactory->getClass(get_class($bean));
if ($rClass->hasProperty($name)) {
$rProperty = $rClass->getProperty($name);
if (!$rProperty->isPublic()) {
$rProperty->setAccessible(tr... | php | {
"resource": ""
} |
q262118 | ContainerImpl.getBean | test | public function getBean($name)
{
$ret = false;
$beanDefinition = $this->getBeanDefinition($name);
$beanName = $name . '.bean';
if ($beanDefinition->isAbstract()) {
throw new BeanFactoryException(
"Cant instantiate abstract bean: $name"
);
... | php | {
"resource": ""
} |
q262119 | ContainerImpl.getInstance | test | public static function getInstance(array $properties = array())
{
if (self::$_containerInstance === false) {
// Init cache subsystems.
if (isset($properties['ding']['cache'])) {
CacheLocator::configure($properties['ding']['cache']);
}
if (isset... | php | {
"resource": ""
} |
q262120 | ContainerImpl.fillAware | test | public function fillAware(BeanDefinition $def, $bean)
{
$class = get_class($bean);
$rClass = $this->_reflectionFactory->getClass($class);
if ($rClass->implementsInterface('Ding\Reflection\IReflectionFactoryAware')) {
$bean->setReflectionFactory($this->_reflectionFactory);
... | php | {
"resource": ""
} |
q262121 | ContainerImpl.signalHandler | test | public function signalHandler($signo)
{
$msg = "Caught Signal: $signo";
$this->_logger->warn($msg);
$this->eventDispatch('dingSignal', $signo);
} | php | {
"resource": ""
} |
q262122 | Autoloader.load | test | public static function load($class)
{
$classFile = str_replace('\\', DIRECTORY_SEPARATOR, $class) . '.php';
$file = stream_resolve_include_path($classFile);
if ($file && file_exists($file)) {
require_once $file;
return true;
}
return false;
} | php | {
"resource": ""
} |
q262123 | BeanDefinition.makeChildBean | test | public function makeChildBean($childName)
{
$bean = serialize($this);
$bean = unserialize($bean);
$bean->setName($childName);
$bean->clearAliases();
$bean->makeConcrete();
return $bean;
} | php | {
"resource": ""
} |
q262124 | ReflectionFactory._populateClassesPerAnnotations | test | private function _populateClassesPerAnnotations($class, Collection $annotations)
{
foreach ($annotations->getAll() as $name => $annotation) {
$cacheKey = $name . '.classbyannotations';
if (!isset($this->_classesAnnotated[$name])) {
$this->_classesAnnotated[$name] = ar... | php | {
"resource": ""
} |
q262125 | Xml._loadXml | test | private function _loadXml($filename)
{
$xmls = array();
libxml_use_internal_errors(true);
if (is_array($filename)) {
foreach ($filename as $file) {
$result = $this->_loadXml($file);
if ($result !== false) {
foreach ($result as $... | php | {
"resource": ""
} |
q262126 | Xml._load | test | private function _load()
{
if ($this->_simpleXml !== false) {
return;
}
$this->_simpleXml = $this->_loadXml($this->_filename);
if (empty($this->_simpleXml)) {
throw new BeanFactoryException(
'Could not parse: ' . $this->_filename
... | php | {
"resource": ""
} |
q262127 | TcpServerHelper.close | test | public function close()
{
$this->_open = false;
$this->_peers = array();
$this->_peersSockets = array();
$this->_peersLastDataReceived = array();
$this->_handler->close();
socket_close($this->_socket);
$this->_socket = false;
} | php | {
"resource": ""
} |
q262128 | TcpServerHelper.open | test | public function open()
{
$this->_open = false;
$this->_handler->beforeOpen();
$this->_socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($this->_socket === false) {
throw new TcpException(
'Error opening socket: ' . socket_strerror(socket_last_error()... | php | {
"resource": ""
} |
q262129 | TcpServerHelper._freePeer | test | private function _freePeer(\Ding\Helpers\Tcp\TcpPeer $peer)
{
$peerName = $peer->getName();
unset($this->_peers[$peerName]);
unset($this->_peersSockets[$peerName]);
unset($this->_peersLastDataReceived[$peerName]);
} | php | {
"resource": ""
} |
q262130 | Proxy.createClass | test | protected function createClass($newName, array $proxyMethods, \ReflectionClass $class)
{
$src = $this->proxyTemplate;
$src = str_replace('NEW_NAME', $newName, $src);
$src = str_replace('CLASS_NAME', $class->getName(), $src);
$methods = array();
foreach ($proxyMethods as $meth... | php | {
"resource": ""
} |
q262131 | Proxy.createParameter | test | protected function createParameter(\ReflectionParameter $parameter)
{
$parameterSrc = '';
$paramClass = $parameter->getClass();
if ($parameter->isArray()) {
$parameterSrc .= 'array ';
} else if ($paramClass) {
$parameterSrc .= $paramClass->getName() . ' ';
... | php | {
"resource": ""
} |
q262132 | Proxy.createMethod | test | protected function createMethod(\ReflectionMethod $method)
{
$visibility = '';
$additional = '';
$name = $method->getName();
if ($method->isPublic()) {
$visibility = ' public';
} else if ($method->isProtected()) {
$visibility = ' protected';
} ... | php | {
"resource": ""
} |
q262133 | Proxy.create | test | public function create($class, IDispatcher $dispatcher)
{
$subject = $this->reflectionFactory->getClass($class);
$proxyClassName = 'Proxy' . str_replace('\\', '', $subject->getName());
$cacheKey = $proxyClassName . '.proxy';
$result = false;
$src = $this->cache->fetch($cacheK... | php | {
"resource": ""
} |
q262134 | Yaml._loadYaml | test | private function _loadYaml($filename)
{
$yamls = array();
if (is_array($filename)) {
foreach ($filename as $file) {
foreach ($this->_loadYaml($file) as $name => $yaml) {
$yamls[$name] = $yaml;
}
}
return $yamls;
... | php | {
"resource": ""
} |
q262135 | Yaml._load | test | private function _load()
{
if ($this->_yamlFiles !== false) {
return;
}
$this->_yamlFiles = $this->_loadYaml($this->_filename);
if (empty($this->_yamlFiles)) {
throw new BeanFactoryException('Could not parse: ' . $this->_filename);
}
} | php | {
"resource": ""
} |
q262136 | PamiHelper._load | test | private function _load()
{
$options = array(
'host' => $this->_host,
'port' => $this->_port,
'username' => $this->_user,
'secret' => $this->_pass,
'connect_timeout' => $this->_connect_timeout,
'read_timeout' => $this->_read_timeout
... | php | {
"resource": ""
} |
q262137 | PamiHelper.open | test | public function open()
{
if (!$this->_init) {
$this->_load();
}
$this->_ami->registerEventListener($this);
$this->_ami->open();
} | php | {
"resource": ""
} |
q262138 | CacheLocator._returnCacheFromImpl | test | private static function _returnCacheFromImpl($options)
{
switch ($options['impl'])
{
case 'file':
return FileCacheImpl::getInstance($options);
case 'apc':
return ApcCacheImpl::getInstance($options);
case 'dummy':
return DummyCacheImpl::getI... | php | {
"resource": ""
} |
q262139 | BeanLifecycleManager.afterDefinition | test | public function afterDefinition(BeanDefinition $bean)
{
$return = $bean;
foreach ($this->_lifecyclers[BeanLifecycle::AfterDefinition] as $lifecycleListener) {
$return = $lifecycleListener->afterDefinition($return);
}
return $return;
} | php | {
"resource": ""
} |
q262140 | BeanLifecycleManager.beforeCreate | test | public function beforeCreate(BeanDefinition $beanDefinition)
{
foreach ($this->_lifecyclers[BeanLifecycle::BeforeCreate] as $lifecycleListener) {
$lifecycleListener->beforeCreate($beanDefinition);
}
} | php | {
"resource": ""
} |
q262141 | BeanLifecycleManager.afterCreate | test | public function afterCreate($bean, BeanDefinition $beanDefinition)
{
foreach ($this->_lifecyclers[BeanLifecycle::AfterCreate] as $lifecycleListener) {
$lifecycleListener->afterCreate($bean, $beanDefinition);
}
} | php | {
"resource": ""
} |
q262142 | BeanLifecycleManager.beforeAssemble | test | public function beforeAssemble($bean, BeanDefinition $beanDefinition)
{
foreach ($this->_lifecyclers[BeanLifecycle::BeforeAssemble] as $lifecycleListener) {
$lifecycleListener->beforeAssemble($bean, $beanDefinition);
}
} | php | {
"resource": ""
} |
q262143 | BeanLifecycleManager.afterAssemble | test | public function afterAssemble($bean, BeanDefinition $beanDefinition)
{
foreach ($this->_lifecyclers[BeanLifecycle::AfterAssemble] as $lifecycleListener) {
$lifecycleListener->afterAssemble($bean, $beanDefinition);
}
} | php | {
"resource": ""
} |
q262144 | SyslogHelper.open | test | public function open()
{
openlog($this->_ident, intval($this->_options), intval($this->_facility));
} | php | {
"resource": ""
} |
q262145 | DispatcherImpl.getInterceptors | test | public function getInterceptors($method)
{
if (!isset($this->_methodsIntercepted[$method])) {
return false;
}
return $this->_methodsIntercepted[$method];
} | php | {
"resource": ""
} |
q262146 | DispatcherImpl.getExceptionInterceptors | test | public function getExceptionInterceptors($method)
{
if (!isset($this->_methodsExceptionIntercepted[$method])) {
return false;
}
return $this->_methodsExceptionIntercepted[$method];
} | php | {
"resource": ""
} |
q262147 | DispatcherImpl._callInterceptors | test | private function _callInterceptors(
MethodInvocation $invocation, array $interceptors
) {
$total = count($interceptors) - 1;
$invocationChain = $invocation;
for ($i = $total; $i >= 0; $i--) {
$newInvocation = new MethodInvocation(
get_class($interceptors[$... | php | {
"resource": ""
} |
q262148 | DispatcherImpl.invokeException | test | public function invokeException(MethodInvocation $invocation)
{
$interceptors = $this->getExceptionInterceptors($method = $invocation->getMethod());
if ($interceptors != false && !empty($interceptors)) {
return $this->_callInterceptors($invocation, $interceptors);
}
throw... | php | {
"resource": ""
} |
q262149 | DispatcherImpl.invoke | test | public function invoke(MethodInvocation $invocation)
{
$interceptors = $this->getInterceptors($invocation->getMethod());
if ($interceptors != false) {
return $this->_callInterceptors($invocation, $interceptors);
}
return $invocation->proceed();
} | php | {
"resource": ""
} |
q262150 | TcpClientHelper.close | test | public function close()
{
$this->_connected = false;
$this->_handler->disconnect();
socket_close($this->_socket);
$this->_socket = false;
} | php | {
"resource": ""
} |
q262151 | TcpClientHelper.read | test | public function read(&$buffer, $length, $peek = false)
{
$length = socket_recv($this->_socket, $buffer, $length, $peek ? MSG_PEEK : 0);
return $length;
} | php | {
"resource": ""
} |
q262152 | TcpClientHelper.open | test | public function open($address = false, $port = false)
{
$this->_connected = false;
$this->_socket = socket_create(AF_INET, SOCK_STREAM, SOL_TCP);
if ($this->_socket === false) {
throw new TcpException(
'Error opening socket: ' . socket_strerror(socket_last_error())
... | php | {
"resource": ""
} |
q262153 | ModelAndView.add | test | public function add(array $objects)
{
foreach ($objects as $name => $value) {
$this->_objects[$name] = $value;
}
} | php | {
"resource": ""
} |
q262154 | WhoopsEditorServiceProvider.buildUri | test | protected function buildUri(string $uri, string $filePath, int $line): string
{
$uri = str_replace('%file', $filePath, $uri);
$uri = str_replace('%line', $line, $uri);
return $uri;
} | php | {
"resource": ""
} |
q262155 | WhoopsEditorServiceProvider.overwriteAppConfig | test | protected function overwriteAppConfig()
{
$this->config = $this->app->make('config');
$editor = $this->resolveEditor();
$editorConfig = $this->config->get('whoops-editor.editors.' . $editor);
if (!$editorConfig) {
$this->overwriteAppEditor($editor);
return;
... | php | {
"resource": ""
} |
q262156 | WhoopsEditorServiceProvider.resolveFilePath | test | protected function resolveFilePath(string $filePath): string
{
$localPath = $this->config->get('whoops-editor.local-projects-path');
$homesteadPath = $this->config->get('whoops-editor.homestead-projects-path');
if (!$localPath || !$homesteadPath) {
return $filePath;
}
... | php | {
"resource": ""
} |
q262157 | Page.publishedDropDownList | test | public static function publishedDropDownList()
{
$formatter = Yii::$app->formatter;
return [
false => $formatter->asBoolean(false),
true => $formatter->asBoolean(true),
];
} | php | {
"resource": ""
} |
q262158 | DefaultController.findModel | test | protected function findModel($alias)
{
$model = Page::find()->where([
'alias' => $alias,
'published' => true,
])->one();
if ($model !== null) {
return $model;
}
throw new NotFoundHttpException(Module::t('PAGE_NOT_FOUND'));
} | php | {
"resource": ""
} |
q262159 | Link.build | test | public static function build($name, $url, $isInternal, $isNewtab)
{
$link = new static;
$link->title = $name;
$link->url = $url;
$link->is_internal = (bool) $isInternal;
$link->is_newtab = (bool) $isNewtab;
return $lin... | php | {
"resource": ""
} |
q262160 | ManagerController.actionUpdate | test | public function actionUpdate($id = null)
{
if ($id === null) {
$model = new Page();
$model->display_title = true;
} else {
$model = $this->findModel($id);
}
if ($model->load(Yii::$app->request->post()) && $model->save()) {
Yii::$app->s... | php | {
"resource": ""
} |
q262161 | DatePicker.registerTranslations | test | private function registerTranslations()
{
Yii::$app->i18n->translations['datepicker'] = [
'class' => 'yii\i18n\PhpMessageSource',
'sourceLanguage' => 'en-US',
'basePath' => __DIR__ . DIRECTORY_SEPARATOR . 'messages',
'forceTranslation' => true,
];
... | php | {
"resource": ""
} |
q262162 | DatePicker.registerClientScript | test | public function registerClientScript()
{
$js = [];
$view = $this->getView();
DatePickerAsset::register($view);
$id = $this->options['id'];
$selector = ";jQuery('#$id')";
if ($this->addon) {
$selector .= ".parent()";
}
$this->hashPluginO... | php | {
"resource": ""
} |
q262163 | EditUserVoter.vote | test | public function vote(TokenInterface $token, $object, array $attributes)
{
$user = $token->getUser();
foreach ($attributes as $attribute) {
if (!$this->supportsAttribute($attribute)) {
continue;
}
if ($this->hasRole($token, 'ROLE_ADMIN')) {
... | php | {
"resource": ""
} |
q262164 | Mailer.getFromEmail | test | protected function getFromEmail()
{
if (!$this->fromAddress) {
return null;
}
if ($this->fromName) {
return array($this->fromAddress => $this->fromName);
}
return $this->fromAddress;
} | php | {
"resource": ""
} |
q262165 | UserManager.loadUserByUsername | test | public function loadUserByUsername($username)
{
if (strpos($username, '@') !== false) {
$user = $this->findOneBy(array($this->getUserColumns('email') => $username));
if (!$user) {
throw new UsernameNotFoundException(sprintf('Email "%s" does not exist.', $username));
... | php | {
"resource": ""
} |
q262166 | UserManager.hydrateUser | test | protected function hydrateUser(array $data)
{
// Test for new columns added in v2.0.
// If they're missing, throw an exception and explain that migration is needed.
foreach (array(
$this->getUserColumns('username'),
$this->getUserColumns('isEnabled'),
... | php | {
"resource": ""
} |
q262167 | UserManager.createUser | test | public function createUser($email, $plainPassword, $name = null, $roles = array())
{
$userClass = $this->getUserClass();
$user = new $userClass($email);
if (!empty($plainPassword)) {
$this->setUserPassword($user, $plainPassword);
}
if ($name !== null) {
... | php | {
"resource": ""
} |
q262168 | UserManager.setUserPassword | test | public function setUserPassword(User $user, $password)
{
$user->setPassword($this->encodeUserPassword($user, $password));
} | php | {
"resource": ""
} |
q262169 | UserManager.checkUserPassword | test | public function checkUserPassword(User $user, $password)
{
return $user->getPassword() === $this->encodeUserPassword($user, $password);
} | php | {
"resource": ""
} |
q262170 | UserManager.isLoggedIn | test | function isLoggedIn()
{
$token = $this->app['security']->getToken();
if (null === $token) {
return false;
}
return $this->app['security']->isGranted('IS_AUTHENTICATED_REMEMBERED');
} | php | {
"resource": ""
} |
q262171 | UserManager.findOneBy | test | public function findOneBy(array $criteria)
{
$users = $this->findBy($criteria);
if (empty($users)) {
return null;
}
return reset($users);
} | php | {
"resource": ""
} |
q262172 | UserManager.findBy | test | public function findBy(array $criteria = array(), array $options = array())
{
// Check the identity map first.
if (array_key_exists($this->getUserColumns('id'), $criteria)
&& array_key_exists($criteria[$this->getUserColumns('id')], $this->identityMap)) {
return array($this->... | php | {
"resource": ""
} |
q262173 | UserManager.createCommonFindSql | test | protected function createCommonFindSql(array $criteria = array())
{
$params = array();
$sql = 'FROM ' . $this->conn->quoteIdentifier($this->userTableName). ' ';
// JOIN on custom fields, if needed.
if (array_key_exists('customFields', $criteria)) {
$i = 0;
fo... | php | {
"resource": ""
} |
q262174 | UserManager.findCount | test | public function findCount(array $criteria = array())
{
list ($common_sql, $params) = $this->createCommonFindSql($criteria);
$sql = 'SELECT COUNT(*) ' . $common_sql;
return $this->conn->fetchColumn($sql, $params) ?: 0;
} | php | {
"resource": ""
} |
q262175 | UserManager.insert | test | public function insert(User $user)
{
$this->dispatcher->dispatch(UserEvents::BEFORE_INSERT, new UserEvent($user));
$sql = 'INSERT INTO ' . $this->conn->quoteIdentifier($this->userTableName) . '
('.$this->getUserColumns('email').', '.$this->getUserColumns('password').', '.$this->getUserC... | php | {
"resource": ""
} |
q262176 | UserManager.update | test | public function update(User $user)
{
$this->dispatcher->dispatch(UserEvents::BEFORE_UPDATE, new UserEvent($user));
$sql = 'UPDATE ' . $this->conn->quoteIdentifier($this->userTableName). '
SET '.$this->getUserColumns('email').' = :email
, '.$this->getUserColumns('password').'... | php | {
"resource": ""
} |
q262177 | UserManager.delete | test | public function delete(User $user)
{
$this->dispatcher->dispatch(UserEvents::BEFORE_DELETE, new UserEvent($user));
$this->clearIdentityMap($user);
$this->conn->executeUpdate('DELETE FROM ' . $this->conn->quoteIdentifier($this->userTableName). ' WHERE '.$this->getUserColumns('id').' = ?', a... | php | {
"resource": ""
} |
q262178 | UserManager.validate | test | public function validate(User $user)
{
$errors = $user->validate();
// Ensure email address is unique.
$duplicates = $this->findBy(array($this->getUserColumns('email') => $user->getEmail()));
if (!empty($duplicates)) {
foreach ($duplicates as $dup) {
if (... | php | {
"resource": ""
} |
q262179 | UserManager.clearIdentityMap | test | public function clearIdentityMap($user = null)
{
if ($user === null) {
$this->identityMap = array();
} else if ($user instanceof User && array_key_exists($user->getId(), $this->identityMap)) {
unset($this->identityMap[$user->getId()]);
} else if (is_numeric($user) && ... | php | {
"resource": ""
} |
q262180 | UserManager.loginAsUser | test | public function loginAsUser(User $user)
{
if (null !== ($current_token = $this->app['security']->getToken())) {
$providerKey = method_exists($current_token, 'getProviderKey') ? $current_token->getProviderKey() : $current_token->getKey();
$token = new UsernamePasswordToken($user, null... | php | {
"resource": ""
} |
q262181 | ProcessPool.init | test | private function init($force = false)
{
if (!function_exists('pcntl_signal') || ($this->initialized && !$force)) {
return;
}
$this->initialized = true;
pcntl_signal(SIGCHLD, array($this, 'signalHandler'));
} | php | {
"resource": ""
} |
q262182 | ProcessPool.reaper | test | public function reaper($pid = null, $status = null)
{
if ($pid === null) {
$pid = pcntl_waitpid(-1, $status, WNOHANG);
}
while ($pid > 0) {
if (isset($this->workers[$pid])) {
// @todo does the socket really need to be closed?
//@socket... | php | {
"resource": ""
} |
q262183 | ProcessPool.wait | test | public function wait($timeout = null)
{
$x = null; // trash var needed for socket_select
$startTime = microtime(true);
while (true) {
$this->apply(); // maintain worker queue
// check each child socket pair for a new resul... | php | {
"resource": ""
} |
q262184 | ProcessPool.get | test | public function get($timeout = null, $nullOnTimeout = false)
{
$startTime = microtime(true);
while ($this->getPending()) {
// return the next result
if ($this->hasResult()) {
return $this->getResult();
}
// wait for the next result
... | php | {
"resource": ""
} |
q262185 | ProcessPool.getAll | test | public function getAll($timeout = null, $nullOnTimeout = false)
{
$results = array();
$startTime = microtime(true);
while ($this->getPending()) {
try {
$res = $this->get($timeout);
if ($res !== null) {
$results[] = $res;
... | php | {
"resource": ""
} |
q262186 | ProcessPool.apply | test | public function apply($func = null)
{
// add new function to pending queue
if ($func !== null) {
if ($func instanceof \Closure or $func instanceof ProcessInterface or is_callable($func)) {
$this->pending[] = func_get_args();
} else {
throw new ... | php | {
"resource": ""
} |
q262187 | ProcessPool.getPending | test | public function getPending($pendingOnly = false)
{
if ($pendingOnly) {
return count($this->pending);
}
return count($this->pending) + count($this->workers) + count($this->results);
} | php | {
"resource": ""
} |
q262188 | ProcessPool.socket_send | test | public static function socket_send($socket, $data)
{
$serialized = serialize($data);
$hdr = pack('N', strlen($serialized)); // 4 byte length
$buffer = $hdr . $serialized;
$total = strlen($buffer);
while (true) {
$sent = socket_write($socket, $buffer);
... | php | {
"resource": ""
} |
q262189 | ProcessPool.socket_fetch | test | public static function socket_fetch($socket)
{
// read 4 byte length first
$hdr = '';
do {
$read = socket_read($socket, 4 - strlen($hdr));
if ($read === false or $read === '') {
return null;
}
$hdr .= $read;
} while (str... | php | {
"resource": ""
} |
q262190 | MigrateV1ToV2.sqlDownData | test | public function sqlDownData()
{
// Map columns to custom fields.
$colmap = array();
foreach ($this->fieldmap as $field => $col) {
$colmap[$col] = $field;
}
// Test that the v2 columns actually exist.
$existingCols = $this->conn->getSchemaManager()->listTa... | php | {
"resource": ""
} |
q262191 | UserController.registerAction | test | public function registerAction(Application $app, Request $request)
{
if ($request->isMethod('POST')) {
try {
$user = $this->createUserFromRequest($request);
if ($error = $this->userManager->validatePasswordStrength($user, $request->request->get('password'))) {
... | php | {
"resource": ""
} |
q262192 | UserController.confirmEmailAction | test | public function confirmEmailAction(Application $app, Request $request, $token)
{
$user = $this->userManager->findOneBy(array('confirmationToken' => $token));
if (!$user) {
$app['session']->getFlashBag()->set('alert', 'Sorry, your email confirmation link has expired.');
retur... | php | {
"resource": ""
} |
q262193 | UserController.loginAction | test | public function loginAction(Application $app, Request $request)
{
$authException = $app['user.last_auth_exception']($request);
if ($authException instanceof DisabledException) {
// This exception is thrown if (!$user->isEnabled())
// Warning: Be careful not to disclose any u... | php | {
"resource": ""
} |
q262194 | UserController.resendConfirmationAction | test | public function resendConfirmationAction(Application $app, Request $request)
{
$email = $request->request->get('email');
$user = $this->userManager->findOneBy(array('email' => $email));
if (!$user) {
throw new NotFoundHttpException('No user account was found with that email addre... | php | {
"resource": ""
} |
q262195 | UserController.viewAction | test | public function viewAction(Application $app, Request $request, $id)
{
$user = $this->userManager->getUser($id);
if (!$user) {
throw new NotFoundHttpException('No user was found with that ID.');
}
if (!$user->isEnabled() && !$app['security']->isGranted('ROLE_ADMIN')) {
... | php | {
"resource": ""
} |
q262196 | UserController.editAction | test | public function editAction(Application $app, Request $request, $id)
{
$errors = array();
$user = $this->userManager->getUser($id);
if (!$user) {
throw new NotFoundHttpException('No user was found with that ID.');
}
$customFields = $this->editCustomFields ?: arra... | php | {
"resource": ""
} |
q262197 | User.validate | test | public function validate()
{
$errors = array();
if (!$this->getEmail()) {
$errors['email'] = 'Email address is required.';
} else if (!strpos($this->getEmail(), '@')) {
// Basic email format sanity check. Real validation comes from sending them an email with a link t... | php | {
"resource": ""
} |
q262198 | UserServiceProvider.connect | test | public function connect(Application $app)
{
if (!$app['resolver'] instanceof ServiceControllerResolver) {
// using RuntimeException crashes PHP?!
throw new \LogicException('You must enable the ServiceController service provider to be able to use these routes.');
}
/*... | php | {
"resource": ""
} |
q262199 | FormattedResponder.priorities | test | protected function priorities()
{
$priorities = [];
foreach ($this as $formatter => $quality) {
foreach ($formatter::accepts() as $type) {
$priorities[$type] = $formatter;
}
}
return $priorities;
} | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.