sentence1
stringlengths
52
3.87M
sentence2
stringlengths
1
47.2k
label
stringclasses
1 value
public function generateIsotopeVisitHitTop($VisitorsID, $limit = 20, $parse = true) { $arrIsotopeStatCount = false; //Isotope Table exists? if (true === $this->getIsotopeTableExists()) { $objIsotopeStatCount = \Database::getInstance() ...
////////////////////////////////////////////////////////////
entailment
protected function reset() { //NEVER TRUST USER INPUT if (function_exists('filter_var')) // Adjustment for hoster without the filter extension { $this->_http_referer = isset($_SERVER['HTTP_REFERER']) ? filter_var($_SERVER['HTTP_REFERER'], FILTER_SANITIZE_URL) : self::REFERER_UNKNOWN ; } ...
Reset all properties
entailment
protected function checkEngineGeneric() { if ( preg_match('/\?q=/', $this->_http_referer ) || preg_match('/\&q=/', $this->_http_referer ) ) { $this->_search_engine = self::SEARCH_ENGINE_GENERIC ; if ( isset($this->_parse_result['q']) ) { $this->_keywords = $this->_parse_result['q'];...
Last Check for unknown Search Engines @return bool
entailment
public function process(InvokeSpec $specifier): ResultSpec { $resultUnits = []; $callUnits = $specifier->getUnits(); foreach ($callUnits as $unit) { $unit = $this->preProcess($unit); if ($unit instanceof Invoke\Invoke) { $resultUnits[] = $this->han...
@param InvokeSpec $specifier @return ResultSpec
entailment
private function preProcess(AbstractInvoke $invoke): AbstractInvoke { $result = $this->preProcess->handle(new ProcessorContainer($this, $invoke)); if ($result instanceof ProcessorContainer) { return $result->getInvoke(); } throw new \RuntimeException(); }
@param AbstractInvoke $invoke @return AbstractInvoke
entailment
private function handleCallUnit(Invoke\Invoke $unit): Result\AbstractResult { try { list($class, $method) = $this->getClassAndMethod($unit->getRawMethod()); $result = $this->invoker->invoke($this->handlers[$class], $method, $unit->getRawParams()); } catch (JsonRpcException $e...
@param Invoke\Invoke $unit @return Result\AbstractResult
entailment
private function handleNotificationUnit(Invoke\Notification $unit): Result\AbstractResult { try { list($class, $method) = $this->getClassAndMethod($unit->getRawMethod()); $this->invoker->invoke($this->handlers[$class], $method, $unit->getRawParams()); } catch (JsonRpcExceptio...
@param Invoke\Notification $unit @return Result\AbstractResult
entailment
private function handleErrorUnit(Invoke\Error $unit): Result\AbstractResult { return new Result\Error(null, $unit->getBaseException()); }
@param Invoke\Error $unit @return Result\AbstractResult
entailment
private function getClassAndMethod(string $requestedMethod) { list($class, $method) = $this->mapper->getClassAndMethod($requestedMethod); if ($class && array_key_exists($class, $this->handlers) && method_exists($this->handlers[$class], $method)) { return [$class, $method]; } ...
@param string $requestedMethod @return array
entailment
public function build(ResultSpec $result): string { $response = []; $units = $result->getResults(); foreach ($units as $unit) { /** @var AbstractResult $unit */ if ($unit instanceof Result) { /** @var Result $unit */ $response[] = [ ...
@param ResultSpec $result @return string
entailment
private function preBuild($result) { $container = $this->preBuild->handle(new BuilderContainer($this, $result)); if ($container instanceof BuilderContainer) { return $container->getValue(); } throw new \RuntimeException(); }
@param mixed $result @return mixed
entailment
public function fetchJson($parameters = []) { if (!isset($parameters['url'])) { Craft::error('URL parameter not set', __METHOD__); return false; } $data = self::getUrl($parameters['url']); return json_decode($data, true); }
Returns JSON from URL. @param array $parameters Parameters, just URL for now. @return string
entailment
protected static function getUrl($url) { Craft::debug('Fetching JSON from: '.$url, __METHOD__); $ch = curl_init(); curl_setopt_array( $ch, [ CURLOPT_URL => $url, CURLOPT_RETURNTRANSFER => true, CURLOPT_FOLLOWLOCATION =>...
Function for actually getting data with cURL Improvements: - Use Guzzle? - Check mimetype? @param string $url URL to fetch @return mixed
entailment
public function updateCMSFields(FieldList $fields) { $msg = _t('JonoM\ShareCare\ShareCareFields.CMSMessage', 'The preview is automatically generated from your content. You can override the default values using these fields:'); $tab = 'Root.' . _t('JonoM\ShareCare\ShareCare.TabName', 'Share'); ...
Add CMS fields to allow setting of custom open graph values.
entailment
public function getOGTitle() { return ($this->owner->OGTitleCustom) ? $this->owner->OGTitleCustom : $this->owner->getDefaultOGTitle(); }
The title that will be used in the 'og:title' open graph tag. Use a custom value if set, or fallback to a default value. @return string
entailment
public function getOGDescription() { // Use OG Description if set if ($this->owner->OGDescriptionCustom) { $description = trim($this->owner->OGDescriptionCustom); if (!empty($description)) { return $description; } } return $this->o...
The description that will be used in the 'og:description' open graph tag. Use a custom value if set, or fallback to a default value. @return string
entailment
public function getDefaultOGDescription() { // Use MetaDescription if set if ($this->owner->MetaDescription) { $description = trim($this->owner->MetaDescription); if (!empty($description)) { return $description; } } // Fall back to...
The default/fallback value to be used in the 'og:description' open graph tag. @return string
entailment
public function getOGImage() { $ogImage = $this->owner->OGImageCustom(); if ($ogImage->exists()) { return ($ogImage->getWidth() > 1200) ? $ogImage->scaleWidth(1200) : $ogImage; } return $this->owner->getDefaultOGImage(); }
The Image object or absolute URL that will be used for the 'og:image' open graph tag. Use a custom selection if set, or fallback to a default value. Image size specs: https://developers.facebook.com/docs/sharing/best-practices#images. @return Image|string|false
entailment
public function getPinterestImage() { $pinImage = $this->owner->PinterestImageCustom(); if ($pinImage->exists()) { return ($pinImage->getWidth() > 1200) ? $pinImage->scaleWidth(1200) : $pinImage; } return $this->owner->getOGImage(); }
Get an Image object to be used in the 'Pin it' ($PinterestShareLink) link. Image size specs: https://developers.pinterest.com/pin_it/. @return Image|null
entailment
protected function getUploadedFile($data) { $file = null; if ($data !== null && is_array($data) && isset($data[FileType::RADIO_FIELDNAME])) { switch ($data[FileType::RADIO_FIELDNAME]) { case FileType::FILE_URL: if (!empty($data[FileType::URL_FIELDNAME...
Get the File object from the form data. @param array $data @return null|File|UploadedFile
entailment
protected function validateFile($file, FormEvent $event) { if ($file instanceof File) { $isValidFile = true; //check if the file is allowed by the MIME-types constraint given if (!empty($this->allowedFileTypes) && null !== $mime = $file->getMimeType()) { ...
Validate file. @param File $file @param FormEvent $event
entailment
public function preSubmit(FormEvent $event) { $data = $event->getData(); $entity = $event->getForm()->getParent()->getConfig()->getDataClass(); //if the remove checkbox is checked, clear the data if (isset($data[FileType::REMOVE_FIELDNAME]) && $data[FileType::REMOVE_FIELDNAME] === ...
Just before the form is submitted, check if there is no data entered and if so, set the 'old' data back. @param FormEvent $event @return void
entailment
private function prepareData(&$data, $path, $propertyPath) { $file = new File($path); $data[FileType::FILENAME_FIELDNAME] = $file->getBasename(); $data[FileType::HASH_FIELDNAME] = PurgatoryHelper::makeHash($propertyPath, $data[FileType::FILENAME_FIELDNAME]); $data[FileType::UPLOAD_FI...
Prepares the data before sending it to the form @param mixed &$data @param string $path @param string $propertyPath
entailment
public function injectEventManager($assertion, $serviceLocator) { //@TODO: [ZF3] check if ACL working properly /* @var $serviceLocator AssertionManager */ if (!$assertion instanceof EventManagerAwareInterface) { return; } /* @var EventManager $events */ $contai...
Injects a shared event manager aware event manager. @param AssertionInterface $assertion @param ServiceLocatorInterface $serviceLocator
entailment
public static function initializeProxy(EntityManager $em, $obj) { if ($obj instanceof EntityProxy) { $em->getPersistenceContext()->getEntityProxyManager() ->initializeProxy($obj); return; } if ($obj instanceof ArrayObjectProxy) { $obj->initialize(); } }
}
entailment
public static function determineValue(EntityPropertyCollection $entityPropertyCollection, $value, CriteriaProperty $criteriaProperty) { $propertyNames = $criteriaProperty->getPropertyNames(); $entityProperty = null; foreach ($criteriaProperty->getPropertyNames() as $propertyName) { $entityProperty = $e...
}
entailment
public function configureOptions(OptionsResolver $resolver) { $resolver->setDefaults( [ 'entity' => null, 'property' => null, 'show_current_file' => true, 'show_remove' => true, 'show_ke...
{@inheritDoc}
entailment
public function transformCallback($value, $property) { list($property, $id) = $property; return $this->fileManager->getFilePath($this->entities[$id], $property, $value); }
Callback for the FileTransformer - since we can't pass the entity in buildForm, we needed a seperate handler, so the entity is defined :( @param string $value @param string $property @return null|string
entailment
protected function getAllowedTypes(array $options) { $types = null; if (isset($options['file_types'])) { $types = $options['file_types']; $self = $this; if (!is_array($types)) { $types = explode(',', $types); $types = array_map(...
Update options field file_types so if only extension is given it will try to determine mime type @param array $options @return null | mixed;
entailment
public function getMimeType($extension) { /** * check and remove (*.)ext so we only got the extension * when wrong define for example *.jpg becomes jpg */ if (false != preg_match("#^.*\.(?P<EXTENSION>[a-z0-9]{2,4})$#i", $extension, $match)) { $extension = $matc...
mime type converter for lazy loading :) @param string $extension @return string @throws \InvalidArgumentException
entailment
public static function createBindColumnJob(QueryItemSelect $queryItemSelect, Selection $selection) { $columnAliases = array(); foreach ($selection->getSelectQueryItems() as $key => $queryItem) { $columnAliases[$key] = $queryItemSelect->selectQueryItem($queryItem); } return new BindColumnJob($selection, ...
}
entailment
public function isRole($role, $inherit = false, $onlyParents = false) { if ($role instanceof RoleInterface) { $role = $role->getRoleId(); } $userRole = $this->getUser()->getRole(); $isRole = $userRole == $role; /* * @todo remove this, if the admin mod...
Returns true, if the logged in user is of a specific role. If $inherit is TRUE, inheritance is also considered. In that case, the third parameter is used to determine, wether only the direct parent role should be checked or not. @param string|\Zend\Permissions\Acl\Role\RoleInterface $role Matching role. @param bool $...
entailment
public function onRoute(MvcEvent $event) { if ($event->isError()) { return $event->getResult(); } $routeMatch = $event->getRouteMatch(); $routeName = $routeMatch->getMatchedRouteName(); $resourceId = "route/$routeName"; return $this->checkAcl($ev...
@param MvcEvent $event @return array|\ArrayAccess|mixed|object
entailment
public function reverseTransform($value) { if (null === $value) { return null; } if (is_array($value) && array_key_exists(FileType::UPLOAD_FIELDNAME, $value)) { return $value[FileType::UPLOAD_FIELDNAME]; } return null; }
Transforms File -> string (to database) @param mixed $value @return mixed|null
entailment
public function transform($value) { if (is_array($value)) { $value = $value[FileType::UPLOAD_FIELDNAME]; } try { return array( FileType::UPLOAD_FIELDNAME => new File(call_user_func($this->callback, $value, $this->property)) ); } ca...
Transforms string (from database) -> File @param mixed $value @return array|mixed|null
entailment
private function assertAllNonEmptyString(array $values, $parameterName) { foreach ($values as $value) { $this->assertNonEmptyString( $value, $parameterName, 'Elements of "%s" must be non-empty strings, element of type "%s" given' ); ...
@param array $values @param string $parameterName @return void
entailment
public function apply(QueryComparator $queryComparator, QueryState $queryState, QueryPointResolver $queryPointResolver) { $comparatorBuilder = new QueryComparatorBuilder($queryState, $queryPointResolver, $queryComparator); foreach ($this->comparisonDefs as $comparisonDef) { if (isset($comparisonDef['...
}
entailment
public function getInputFilterSpecification() { return array( 'firstName' => array( 'required' => true, 'filters' => array( array('name' => '\Zend\Filter\StringTrim'), ), 'validators' => array( ...
(non-PHPdoc) @see \Zend\InputFilter\InputFilterProviderInterface::getInputFilterSpecification()
entailment
public function beginTransaction() { if ($this->transactionManager === null) { $this->performBeginTransaction(); return; } if (!$this->transactionManager->hasOpenTransaction()) { $this->transactionManager->createTransaction(); } }
(non-PHPdoc) @see PDO::beginTransaction()
entailment
public function commit() { if ($this->transactionManager === null) { $this->prepareCommit(); $this->performCommit(); } if ($this->transactionManager->hasOpenTransaction()) { $this->transactionManager->getRootTransaction()->commit(); } }
(non-PHPdoc) @see PDO::commit()
entailment
public function rollBack() { if ($this->transactionManager === null) { $this->performRollBack(); return; } if ($this->transactionManager->hasOpenTransaction()) { $this->transactionManager->getRootTransaction()->rollBack(); } }
(non-PHPdoc) @see PDO::rollBack()
entailment
public function getDisplayName($emailIfEmpty = true) { if (!$this->lastName) { return $emailIfEmpty ? $this->email : ''; } return ($this->firstName ? $this->firstName . ' ' : '') . $this->lastName; }
@param bool $emailIfEmpty @return string
entailment
public function indexAction() { if ($this->auth->hasIdentity()) { return $this->redirect()->toRoute('lang'); } $viewModel = new ViewModel(); /* @var $loginForm Login */ $loginForm = $this->forms[self::LOGIN]; /* @var $registerForm Register *...
Login with username and password @return \Zend\Http\Response|ViewModel
entailment
public function loginAction() { $ref = urldecode($this->getRequest()->getBasePath().$this->params()->fromQuery('ref')); $provider = $this->params('provider', '--keiner--'); $hauth = $this->hybridAuthAdapter; $hauth->setProvider($provider); $auth = $this->auth; ...
Login with HybridAuth Passed in Params: - provider: HybridAuth provider identifier. Redirects To: Route 'home'
entailment
public function loginExternAction() { $adapter = $this->externalAdapter; $appKey = $this->params()->fromPost('appKey'); $adapter->setIdentity($this->params()->fromPost('user')) ->setCredential($this->params()->fromPost('pass')) ->setApplicationKey($app...
Login via an external Application. This will get obsolet as soon we'll have a full featured Rest API. Passed in params: - appKey: Application identifier key - user: Name of the user to log in - pass: Password of the user to log in Returns an json response with the session-id. Non existent users will be created!
entailment
public function logoutAction() { $auth = $this->auth; $this->logger->info('User ' . ($auth->getUser()->getLogin()==''?$auth->getUser()->getInfo()->getDisplayName():$auth->getUser()->getLogin()) . ' logged out'); $auth->clearIdentity(); unset($_SESSION['HA::STORE']); $this->n...
Logout Redirects To: Route 'home'
entailment
protected function attachDefaultListeners() { parent::attachDefaultListeners(); $events = $this->getEventManager(); /* * "Redirect" action 'new' and 'edit' to 'form' and set the * route parameter 'mode' to the original action. * This must run before onDis...
Register the default events for this controller @internal Registers two hooks on "onDispatch": - change action to form and set mode parameter - inject sidebar navigation
entailment
public function formAction() { $isNew = 'new' == $this->params('mode'); $form = $this->formManager->get('Auth/Group', array('mode' => $this->params('mode'))); $repository = $this->repositories->get('Auth/Group'); if ($isNew) { $group = new \Auth\Entity\G...
Handles the form. Redirects to index on save success. Expected route parameters: - 'mode': string Either 'new' or 'edit'. Expected query parameters: - 'name' string Name of the group (if mode == 'edit') @return Zend\Stdlib\ResponseInterface|array
entailment
public function searchUsersAction() { if (!$this->getRequest()->isXmlHttpRequest()) { throw new \RuntimeException('This action must be called via ajax request'); } $model = new JsonModel(); $query = $this->params()->fromPost('query', false); if (!$query) ...
Helper action for userselect form element. @return \Zend\View\Model\JsonModel
entailment
public function toHttpQuery() { return '?' . http_build_query( [ 'institution' => $this->institution, 'identityId' => $this->identityId, 'orderBy' => $this->orderBy, 'orderDirection' => $this->orderDirection, ...
Return the Http Query string as should be used, MUST include the '?' prefix. @return string
entailment
public function attachShared(SharedEventManagerInterface $events, $priority = 1000) { /* @var $events \Zend\EventManager\SharedEventManager */ $events->attach('Zend\Mvc\Application', MvcEvent::EVENT_BOOTSTRAP, array($this, 'onBootstrap'), $priority); $this->listener = [$this,'onBootstrap']; ...
Attach to a shared event manager @param SharedEventManagerInterface $events @param integer $priority
entailment
public function detachShared(SharedEventManagerInterface $events) { if ($events->detach($this->listener,'Zend\Mvc\Application')) { $this->listener = null; } return $this; }
Detach all our listeners from the event manager @param SharedEventManagerInterface $events @return $this
entailment
public function getManagedEntities() { $entities = array(); /** @var \Symfony\Component\HttpKernel\Bundle\BundleInterface $bundle */ foreach ($this->kernel->getBundles() as $bundle) { $entityPath = $bundle->getPath() . '/Entity'; if (is_dir($entityPath)) { ...
Returns all entities having file annotations @return array
entailment
public function setDefaultUser($login, $password, $role = \Auth\Entity\User::ROLE_RECRUITER) { $this->defaultUser = array($login, $password, $role); return $this; }
Sets default user login and password. If no password is provided, @param string $login @param string $password @param string $role (default='recruiter') @return self
entailment
public function authenticate() { /* @var $users \Auth\Repository\User */ $identity = $this->getIdentity(); $users = $this->getRepository(); $user = $users->findByLogin($identity, ['allowDeactivated' => true]); $filter = new CredentialFilter(); $cr...
Performs an authentication attempt {@inheritDoc}
entailment
public function getToken() { if (!$this->token) { $session = new Session('Auth'); if (!$session->token) { $session->token = uniqid(); } $this->token = $session->token; } return $this->token; }
Gets the anonymous identification key. @return string
entailment
public function init() { $this->setName('data') ->setLabel('Group data') ->setUseAsBaseFieldset(true) ->setHydrator(new EntityHydrator()); $this->add( array( 'type' => 'Hidden', 'name' => 'id', ) ...
Initialises the fieldset @see \Zend\Form\Element::init()
entailment
public function createDiscriminatorSelection() { $idQueryItems = array(new QueryColumn($this->getIdColumnName(), $this->registerEntityModel($this->entityModel))); $entityModels = array($this->entityModel); foreach ($this->entityModel->getAllSubEntityModels() as $subEntityModel) { $idQueryItems[] = new ...
/* (non-PHPdoc) @see \n2n\persistence\orm\query\from\meta\TreePointMeta::createDiscriminatorSelection()
entailment
protected function setEntity($entityClass) { $this->repos = $this->doctrine->getRepository($entityClass); $this->className = $this->repos->getClassName(); $this->classMetaData = $this->metadataFactory->getMetadataForClass($this->className); }
Set the Entity being processed. @param string $entityClass @return void
entailment
final protected function log($str, $logLevel = 0) { if (isset($this->logger)) { call_user_func($this->logger, $str, $logLevel); } }
Write a log to the logger @param string $str @param int $logLevel @return void
entailment
public function getAutoloaderConfig() { $addProvidersDir = null; $directories = [ __DIR__.'/../../../../hybridauth/hybridauth/additional-providers', __DIR__.'/../../../../vendor/hybridauth/hybridauth/additional-providers', ]; foreach ($directories as $directo...
Loads module specific autoloader configuration. @return array
entailment
public function authenticate() { $hybridAuth = $this->getHybridAuth(); /* @var $adapter \Hybrid_Provider_Model */ $adapter = $hybridAuth->authenticate($this->_provider); $userProfile = $adapter->getUserProfile(); $email = isset($userProfile->emailVerified) && !empty($userPro...
{@inheritdoc} @see \Zend\Authentication\Adapter\AdapterInterface::authenticate()
entailment
public function getEntityPropertyByName($name) { if (!$this->containsEntityPropertyName($name)) { throw new UnknownEntityPropertyException('Unkown entity property: ' . $this->class->getName() . '::$' . $name); } if (isset($this->properties[$name])) return $this->properties[$name]; return $t...
/* (non-PHPdoc) @see \n2n\persistence\orm\model\EntityPropertyCollection::getEntityPropertyByName()
entailment
public function setExpirationDate($expirationDate) { if (is_string($expirationDate)) { $expirationDate = new \DateTime($expirationDate); } $this->expirationDate = $expirationDate; return $this; }
@param \Datetime|string $expirationDate @return self
entailment
public function createDiscriminatorSelection() { return new SingleTableDiscriminatorSelection( $this->registerColumn($this->entityModel, $this->discriminatorColumnName), $this->discriminatedEntityModels); }
/* (non-PHPdoc) @see \n2n\persistence\orm\query\from\meta\TreePointMeta::createDiscriminatorSelection()
entailment
public function getColumnByName(string $name): Column { foreach ($this->columns as $column) { if ($column->getName() == $name) return $column; } throw new UnknownColumnException('Column with name "' . $name . '" does not exist in index "' . $this->name . '" for table "' . $this->table->getName() ...
{@inheritDoc} @see \n2n\persistence\meta\structure\Index::getColumnByName() @return Column
entailment
public function proceed(InputFilterInterface $filter, Plugin\Mailer $mailer, Url $url) { if (!$filter->isValid()) { throw new \LogicException('Form is not valid'); } $identity = $filter->getValue('identity'); $suffix = $this->loginFilter->filter(); if (!($user ...
@todo remove unused $mailer parameter an fix tests @param InputFilterInterface $filter @param Plugin\Mailer $mailer @param Url $url @throws \LogicException @throws UserDoesNotHaveAnEmailException @throws UserNotFoundException
entailment
public function getPrimaryKey(): ?Index { // if the table is not persistent so far, it is possible that it doesn't have a Primary Key $primaryKey = null; foreach ($this->getIndexes() as $index) { if ($index->getType() == IndexType::PRIMARY) { if (null === $this->primaryKey) { $primaryKey = $inde...
{@inheritDoc} @see \n2n\persistence\meta\structure\Table::getPrimaryKey() @return Index
entailment
public function createIndex(string $type, array $columnNames, ?string $name = null, ?Table $refTable = null, ?array $refColumnNames = null): Index { $name = $name ?? $this->generateIndexKeyName($type); $this->triggerChangeListeners(); if ($type !== IndexType::FOREIGN) { ArgUtils::assertTrue(empty($...
{@inheritDoc} @see \n2n\persistence\meta\structure\Table::createIndex()
entailment
public function prepare() { if ($this->isDisabled()) return; // parent::prepare(); foreach ($this->entityAction->getEntityModel()->getEntityProperties() as $entityProperty) { if (!($entityProperty instanceof CascadableEntityProperty)) continue; $propertyString = $entityProperty->toPropertyStr...
}
entailment
public function bindValue($parameter, $value, $dataType = null) { $this->boundValues[$parameter] = $value; if ($dataType !== null) { return parent::bindValue($parameter, $value, $dataType); } else { return parent::bindValue($parameter, $value); } }
(non-PHPdoc) @see PDOStatement::bindValue()
entailment
public function bindParam($parameter, &$variable, $data_type = PDO::PARAM_STR, $length = null, $driver_options = null) { $this->boundValues[$parameter] = $variable; return parent::bindParam($parameter, $variable, $data_type, $length, $driver_options); }
(non-PHPdoc) @see PDOStatement::bindParam()
entailment
public function execute($input_parameters = null) { if (is_array($input_parameters)) $this->boundValues = $input_parameters; try { $mtime = microtime(true); $return = parent::execute($input_parameters); if (isset($this->logger)) { $this->logger->addPreparedExecution($this->queryString, $this-...
(non-PHPdoc) @see PDOStatement::execute()
entailment
public function mergeEntity($entity) { ArgUtils::assertTrue(is_object($entity)); $objHash = spl_object_hash($entity); if (isset($this->mergedEntity[$objHash])) { return $this->mergedEntity[$objHash]; } $em = $this->actionQueue->getEntityManager(); $persistenceContext = $em->getPersistenceC...
/* (non-PHPdoc) @see \n2n\persistence\orm\store\operation\MergeOperation::mergeEntity()
entailment
public function onDispatchError(MvcEvent $e) { $ex = $e->getParam('exception'); $model = $e->getResult(); if ($model instanceof ViewModel && Application::ERROR_EXCEPTION == $e->getError() && 0 === strpos($ex->getMessage(), 'Your application id and secret') ) ...
Sets a specific view template if social network login is unconfigured. @param MvcEvent $e
entailment
final public function typehintMethod($class, string $method, array $custom = []) { $className = get_class($class); $reflectionMethod = new ReflectionMethod($className, $method); $reflectionParameters = $reflectionMethod->getParameters(); $params = $this->resolveParams($reflectionP...
Typehint a class method.
entailment
final public function typehintFunction(string $functionName, array $custom = []) { $reflectionFunction = new ReflectionFunction($functionName); $reflectionParameters = $reflectionFunction->getParameters(); $params = $this->resolveParams($reflectionParameters, $custom); return call...
Typehint a function.
entailment
public function getConfigTreeBuilder() { $treeBuilder = new TreeBuilder(); $rootNode = $treeBuilder->root('zicht_file_manager'); $rootNode->children() // Default behaviour is to lower case file names ->scalarNode('case_preservation')->defaultFalse(); ...
Generates the configuration tree builder. @return \Symfony\Component\Config\Definition\Builder\TreeBuilder The tree builder
entailment
public function move($object, $parentObject = null) { $this->em->flush(); if ($parentObject !== null) { $this->valMove($object, $parentObject); } $newLft = 1; if ($parentObject === null) { if (null !== ($maxRgt = $this->lookupMaxRgt($object))) { $newLft = $maxRgt + 1; } } else...
@link https://rogerkeays.com/how-to-move-a-node-in-nested-sets-with-sql @param object $object @param object $parentObject @throws IllegalStateException
entailment
protected function reset() { IllegalStateException::assertTrue(!$this->init); $this->whenInitializedClosures = array(); while (null !== ($closure = array_shift($this->onResetClosures))) { $closure(); } $this->init = false; }
}
entailment
public function buildJunctionJoinColumnName(\ReflectionClass $targetClass, string $targetIdPropertyName, string $joinColumnName = null): string { if ($joinColumnName !== null) return $joinColumnName; return $targetClass->getShortName() . $targetIdPropertyName; }
/* (non-PHPdoc) @see \n2n\persistence\orm\model\NamingStrategy::buildJunctionJoinColumnName()
entailment
public function createValueBuilder() { try { return new EagerValueBuilder($this->ormDialectConfig->parseDateTime($this->value)); } catch (\InvalidArgumentException $e) { throw new CorruptedDataException(null, 0, $e); } }
/* (non-PHPdoc) @see \n2n\persistence\orm\query\select\Selection::createValueBuilder()
entailment
public function setModificationDate($modificationDate = null) { if (!isset($modificationDate)) { $modificationDate = new \DateTime(); } if (is_string($modificationDate)) { $modificationDate = new \DateTime($modificationDate); } $this->modificationDate ...
@param \Datetime|string $modificationDate @return self
entailment
public function buildJunctionJoinColumnName(\ReflectionClass $targetClass, string $targetIdPropertyName, string $joinColumnName = null): string { if ($joinColumnName !== null) return $joinColumnName; return StringUtils::hyphenated($targetClass->getShortName() . ucfirst($targetIdPropertyName)); }
/* (non-PHPdoc) @see \n2n\persistence\orm\model\NamingStrategy::buildJunctionJoinColumnName()
entailment
public function buildJoinColumnName(string $propertyName, string $targetIdPropertyName, string $joinColumnName = null): string { if ($joinColumnName !== null) return $joinColumnName; return StringUtils::hyphenated($propertyName . ucfirst($targetIdPropertyName)); }
/* (non-PHPdoc) @see \n2n\persistence\orm\model\NamingStrategy::buildJoinColumnName()
entailment
public function hydrate(array $data, $object) { foreach ($data as $name => $value) { if (!isset($this->profileClassMap[$name])) { continue; } if (empty($value)) { // We need to check, if collection has a profile and ...
Adds or removes a social profile from the collection. @param array $data @param Collection $object @see \Zend\Hydrator\HydratorInterface::hydrate() @return \Auth\Entity\SocialProfiles\ProfileInterface
entailment
public function extract($object) { $return = array(); foreach ($object as $profile) { $return[strtolower($profile->getName())] = $profile->getData(); } return $return; }
Extracts profile data from the collection. @param Collection $object @return array profile data in the format [profile name] => [profile data]. @see \Zend\Hydrator\HydratorInterface::extract()
entailment
public function createPropertyJoinedTreePoint(string $propertyName, $joinType): JoinedTreePoint { return $this->createCustomPropertyJoinTreePoint( $this->entityPropertyCollection->getEntityPropertyByName($propertyName), $joinType); }
/* (non-PHPdoc) @see \n2n\persistence\orm\query\from\ExtendableTreePoint::createJoinTreePoint()
entailment
public function findBy(array $criteria, array $sort = null, $limit = null, $skip = null) { if (!array_key_exists('isDraft', $criteria)) { $criteria['isDraft'] = false; } elseif (null === $criteria['isDraft']) { unset($criteria['isDraft']); } if (!arra...
{@inheritDoc}
entailment
public function find($id, $lockMode = \Doctrine\ODM\MongoDB\LockMode::NONE, $lockVersion = null, array $options = []) { return $this->assertEntity(parent::find($id, $lockMode, $lockVersion), $options); }
Finds a document by its identifier @param string|object $id The identifier @param int $lockMode @param int $lockVersion @param array $options @throws Mapping\MappingException @throws LockException @throws UserDeactivatedException @return null | UserInterface
entailment
public function create(array $data = null, $persist=false) { $entity = parent::create($data); $eventArgs = new LifecycleEventArgs($entity, $this->dm); $this->dm->getEventManager()->dispatchEvent( Events::postLoad, $eventArgs ); return $entity;...
Creates a User @see \Core\Repository\AbstractRepository::create() @return UserInterface
entailment
public function findByProfileIdentifier($identifier, $provider, array $options = []) { return $this->findOneBy(array('profiles.' . $provider . '.auth.identifier' => $identifier), $options) ?: $this->findOneBy(array('profile.identifier' => $identifier), $options); }
Finds user by profile identifier @param string $identifier @param string $provider @param array $options @return UserInterface
entailment
public function isProfileAssignedToAnotherUser($curentUserId, $identifier, $provider) { $qb = $this->createQueryBuilder(null); $qb->field('_id')->notEqual($curentUserId) ->addAnd( $qb->expr() ->addOr($qb->expr()->field('profiles.' . $provider . '.auth....
Returns true if profile is already assigned to anotherUser @param int $curentUserId @param string $identifier @param string $provider @return bool
entailment
public function findByEmail($email, $isDraft = false) { $entity = $this->findOneBy( array( '$or' => array( array('email' => $email), array('info.email' => $email), ), 'isDraft' => $isDraft, ) ); retu...
@param $email @param bool $isDraft @return UserInterface|null
entailment
public function findByQuery($query) { $qb = $this->createQueryBuilder(); $parts = explode(' ', trim($query)); foreach ($parts as $q) { $regex = new \MongoRegex('/^' . $query . '/i'); $qb->addOr($qb->expr()->field('info.firstName')->equals($regex)); ...
Find user by query @param String $query @deprecated since 0.19 not used anymore and probably broken. @return object
entailment
public function copyUserInfo(Info $info) { $contact = new Info(); $contact->fromArray(Info::toArray($info)); }
Copy user info into the applications info Entity @param \Auth\Entity\Info $info
entailment
public function createValueBuilder() { try { return new EagerValueBuilder(Url::build($this->value)); } catch (\InvalidArgumentException $e) { throw new \InvalidArgumentException(null, 0, $e); } }
/* (non-PHPdoc) @see \n2n\persistence\orm\query\select\Selection::createValueBuilder()
entailment
public function isAvailable() { if (!empty($this->adapter)) { // adapter is already etablished return true; } $user = $this->getUser(); $sessionDataStored = $user->getAuthSession($this->providerKey); if (empty($sessionDataStored)) { // for ...
for backend there is only one possibility to get a connection, and that is by stored Session @return bool
entailment
public function getAdapter() { if (empty($this->adapter)) { $user = $this->getUser(); $sessionDataStored = $user->getAuthSession($this->providerKey); $hybridAuth = $this->getHybridAuth(); if (!empty($sessionDataStored)) { $hybridAuth->restoreSe...
everything relevant is happening here, included the interactive registration if the User already has a session, it is retrieved
entailment
public function sweepProvider() { $user = $this->getUser(); $hybridAuth = $this->getHybridAuth(); // first test, if there is a connection at all // that prevents an authentification just for to logout if ($hybridAuth->isConnectedWith($this->providerKey)) { $this->...
logout and clears the stored Session,
entailment