_id stringlengths 2 7 | title stringlengths 3 151 | partition stringclasses 3
values | text stringlengths 83 13k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q261800 | Array2Xml.convert | test | protected function convert(\DOMDocument $DOMDocument, \DOMElement $ParentDOMElement, array $array)
{
foreach ($array as $_child_key => $_child_value) {
if (is_string($_child_key)) { // Allows duplicate string keys.
$_child_key = preg_replace('/^[0-9]+_/u', '', $_child_key);
... | php | {
"resource": ""
} |
q261801 | DefaultMarkerClusterHelper.renderMarker | test | protected function renderMarker(Marker $marker, Map $map)
{
return sprintf(
'%s.markers.%s = %s',
$this->getJsContainerName($map),
$marker->getJavascriptVariable(),
$this->markerHelper->render($marker, $map)
);
} | php | {
"resource": ""
} |
q261802 | Keygen.license | test | public function license(): string
{
$key = mb_strtoupper($this->c::uuidV4());
return $key = implode('-', str_split($key, 8));
} | php | {
"resource": ""
} |
q261803 | CoreExtensionHelper.getLibraries | test | protected function getLibraries(Map $map)
{
$libraries = $map->getLibraries();
$encodedPolylines = $map->getEncodedPolylines();
if (!empty($encodedPolylines)) {
$libraries[] = 'geometry';
}
return array_unique($libraries);
} | php | {
"resource": ""
} |
q261804 | Sql.escapeOrder | test | public function escapeOrder(string $order): string
{
$string = mb_strtoupper($order);
return in_array($order, ['ASC', 'DESC'], true) ? $order : 'ASC';
} | php | {
"resource": ""
} |
q261805 | Serializer.serializeClosure | test | public function serializeClosure(\Closure $Closure, bool $faster = false): string
{
// NOTE: No marker; i.e., so this can be called stand-alone if necessary.
return $this->{$faster ? 'ClosureTokenSerializer' : 'ClosureAstSerializer'}->serialize($Closure);
} | php | {
"resource": ""
} |
q261806 | Serializer.unserializeClosure | test | public function unserializeClosure(string $string, bool $faster = false): \Closure
{
if (mb_strpos($string, $this::CLOSURE) === 0) {
$string = mb_substr($string, mb_strlen($this::CLOSURE));
}
return $this->{$faster ? 'ClosureTokenSerializer' : 'ClosureAstSerializer'}->unserialize... | php | {
"resource": ""
} |
q261807 | Serializer.maybeSerialize | test | public function maybeSerialize($value, bool $strict = true): string
{
if (!$strict) {
if (is_string($value)) {
return $string = $value;
} elseif (is_bool($value)) {
return $string = (string) (int) $value;
} elseif (is_int($value) || is_floa... | php | {
"resource": ""
} |
q261808 | Serializer.maybeUnserialize | test | public function maybeUnserialize($value)
{
if ($value && $this->isSerialized($value)) {
if (mb_strpos($value, $this::CLOSURE) === 0) {
return $this->unserializeClosure($value);
} else {
return unserialize($value);
}
} else {
... | php | {
"resource": ""
} |
q261809 | OEmbed.embedlyMarkup | test | protected function embedlyMarkup(string $url, \StdClass $embed): string
{
$markup = ''; // Initialize HTML markup.
if (!$url || empty($embed->type) || empty($embed->provider_name)) {
return $markup; // Not possible; i.e., empty string.
}
$provider_slug = $this->c::nameTo... | php | {
"resource": ""
} |
q261810 | OEmbed.getEmbedlyCache | test | protected function getEmbedlyCache(string $url)
{
$cache_dir = $this->cache_dir.'/embedly';
$cache_dir .= '/'.$this->c::sha1ModShardId($url);
$cache_file = $cache_dir.'/'.sha1($url);
if (is_file($cache_file)) {
$embed = file_get_contents($cache_file);
$embed ... | php | {
"resource": ""
} |
q261811 | OEmbed.viaWordPress | test | protected function viaWordPress(string $string): string
{
if (!$this->c::isWordPress()
|| !$this->c::canCallFunc('wp_oembed_get')
|| !$this->c::canCallFunc('wp_embed_defaults')) {
throw $this->c::issue('Unable to oEmbed via WordPress.');
}
$oembed_args = a... | php | {
"resource": ""
} |
q261812 | EncodedPolylineHelper.render | test | public function render(EncodedPolyline $encodedPolyline, Map $map)
{
$this->jsonBuilder
->reset()
->setValue('[map]', $map->getJavascriptVariable(), false)
->setValue('[path]', $this->encodingHelper->renderDecodePath($encodedPolyline->getValue()), false)
->set... | php | {
"resource": ""
} |
q261813 | Bound.setSouthWest | test | public function setSouthWest()
{
$args = func_get_args();
if (isset($args[0]) && ($args[0] instanceof Coordinate)) {
$this->southWest = $args[0];
} elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) {
if ($this->southWest ... | php | {
"resource": ""
} |
q261814 | Bound.setNorthEast | test | public function setNorthEast()
{
$args = func_get_args();
if (isset($args[0]) && ($args[0] instanceof Coordinate)) {
$this->northEast = $args[0];
} elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) {
if ($this->northEast ... | php | {
"resource": ""
} |
q261815 | Bound.getCenter | test | public function getCenter()
{
$centerLatitude = ($this->getSouthWest()->getLatitude() + $this->getNorthEast()->getLatitude()) / 2;
$centerLongitude = ($this->getSouthWest()->getLongitude() + $this->getNorthEast()->getLongitude()) / 2;
return new Coordinate($centerLatitude, $centerLongitude)... | php | {
"resource": ""
} |
q261816 | FileSize.abbrBytes | test | public function abbrBytes(string $string): int
{
if (!preg_match('/^(?<value>[0-9\.]+)\s*(?<modifier>bytes|byte|kbs|kb|k|mb|m|gb|g|tb|t)$/ui', $string, $_m)) {
return 0; // Default value of `0`, failure.
}
$value = (float) $_m['value'];
$modifier = mb_strtolower($_m['m... | php | {
"resource": ""
} |
q261817 | FileSize.remoteBytes | test | public function remoteBytes(string $url, bool $report_failure = false, int $expires_after = 86400): int
{
if (!$url) { // If no URL, no file size.
return $report_failure ? -1 : 0;
}
if (($bytes = $this->c::dirCacheGet(__METHOD__, $url)) !== null) {
return $bytes; // C... | php | {
"resource": ""
} |
q261818 | UrlParse.un | test | public function un(array $parts): string
{
$scheme = '';
$host = $port = '';
$user = $pass = '';
$path = $query = $fragment = '';
$parts = array_map('strval', $parts);
if (isset($parts['scheme'][0])) {
if ($parts['scheme'] === '... | php | {
"resource": ""
} |
q261819 | CoordinateHelper.render | test | public function render(Coordinate $coordinate)
{
return sprintf(
'%s = new google.maps.LatLng(%s, %s, %s);'.PHP_EOL,
$coordinate->getJavascriptVariable(),
$coordinate->getLatitude(),
$coordinate->getLongitude(),
json_encode($coordinate->isNoWrap())... | php | {
"resource": ""
} |
q261820 | MarkerImageHelper.render | test | public function render(MarkerImage $markerImage)
{
return sprintf(
'%s = new google.maps.MarkerImage("%s", %s, %s, %s, %s);'.PHP_EOL,
$markerImage->getJavascriptVariable(),
$markerImage->getUrl(),
$markerImage->hasSize() ? $markerImage->getSize()->getJavascrip... | php | {
"resource": ""
} |
q261821 | XmlParser.parse | test | public function parse($xml, array $pluralizationRules = array())
{
$parsedXml = json_decode(json_encode(new \SimpleXMLElement($xml)), true);
return $this->pluralize($parsedXml, $pluralizationRules);
} | php | {
"resource": ""
} |
q261822 | XmlParser.pluralize | test | protected function pluralize(array $xml, array $rules)
{
foreach ($xml as $attribute => $value) {
if (isset($rules[$attribute])) {
$xml[$rules[$attribute]] = $value;
unset($xml[$attribute]);
$attribute = $rules[$attribute];
if (!i... | php | {
"resource": ""
} |
q261823 | DistanceMatrixException.invalidDistanceMatrixRequestTravelMode | test | public static function invalidDistanceMatrixRequestTravelMode()
{
$travelModes = array_diff(TravelMode::getTravelModes(), array(TravelMode::TRANSIT));
return new static(sprintf(
'The distance matrix request travel mode can only be : %s.',
implode(', ', $travelModes)
... | php | {
"resource": ""
} |
q261824 | UrlHost.parse | test | public function parse(string $host, bool $no_port = false): array
{
$host = mb_strtolower($host); // `abc.xyz.example.com:80`.
$name = preg_replace('/\:[0-9]+$/u', '', $host); // `abc.xyz.example.com`.
$port = (explode(':', $host, 2) + ['', ''])[1]; // `80`; i.e., port number.
$nam... | php | {
"resource": ""
} |
q261825 | UrlHost.unParse | test | public function unParse(array $parts): string
{
$name = $port= '';
if (isset($parts['name'][0])) {
$name = $parts['name'];
}
if (isset($parts['port'][0])) {
$port = ':'.$parts['port'];
}
return $name.$port;
} | php | {
"resource": ""
} |
q261826 | Marker.setPosition | test | public function setPosition()
{
$args = func_get_args();
if (isset($args[0]) && ($args[0] instanceof Coordinate)) {
$this->position = $args[0];
} elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) {
$this->position->setLat... | php | {
"resource": ""
} |
q261827 | Marker.setAnimation | test | public function setAnimation($animation = null)
{
if (!in_array($animation, Animation::getAnimations()) && ($animation !== null)) {
throw OverlayException::invalidMarkerAnimation();
}
$this->animation = $animation;
} | php | {
"resource": ""
} |
q261828 | Marker.setIcon | test | public function setIcon()
{
$args = func_get_args();
if (isset($args[0]) && ($args[0] instanceof MarkerImage)) {
if ($args[0]->getUrl() === null) {
throw OverlayException::invalidMarkerIconUrl();
}
$this->icon = $args[0];
} elseif (isset(... | php | {
"resource": ""
} |
q261829 | Marker.setShadow | test | public function setShadow()
{
$args = func_get_args();
if (isset($args[0]) && ($args[0] instanceof MarkerImage)) {
if ($args[0]->getUrl() === null) {
throw OverlayException::invalidMarkerShadowUrl();
}
$this->shadow = $args[0];
} elseif (... | php | {
"resource": ""
} |
q261830 | Marker.setShape | test | public function setShape()
{
$args = func_get_args();
if (isset($args[0]) && ($args[0] instanceof MarkerShape)) {
if (!$args[0]->hasCoordinates()) {
throw OverlayException::invalidMarkerShapeCoordinates();
}
$this->shape = $args[0];
} els... | php | {
"resource": ""
} |
q261831 | Markdown.headerIdCallback | test | public function headerIdCallback(string $raw): string
{
$id = mb_strtolower($raw);
$id = preg_replace('/[^\w]+/u', '-', $id);
$id = 'j2h.'.$this->c::mbTrim($id, '', '-');
$this->header_id_counter[$id] = $this->header_id_counter[$id] ?? 0;
++$this->header_id_counter[$id]; // ... | php | {
"resource": ""
} |
q261832 | Markdown.firstImageUrl | test | public function firstImageUrl(string $markdown): string
{
$regex = '/(?<=^|[\s;,])\!\[[^\v[\]]*\]\((?<url>https?\:\/\/[^\s()]+?\.(?:png|jpeg|jpg|gif))\)(?=$|[\s.!?;,])/ui';
return $url = $markdown && preg_match($regex, $markdown, $_m) ? $_m['url'] : '';
} | php | {
"resource": ""
} |
q261833 | HtmlStrip.attributes | test | public function attributes($value, array $args = [])
{
if (is_array($value) || is_object($value)) {
foreach ($value as $_key => &$_value) {
$_value = $this->attributes($_value, $args);
} // unset($_key, $_value);
return $value;
}
if (!($str... | php | {
"resource": ""
} |
q261834 | Rectangle.setBound | test | public function setBound()
{
$args = func_get_args();
if (isset($args[0]) && ($args[0] instanceof Bound)) {
if (!$args[0]->hasCoordinates()) {
throw OverlayException::invalidRectangleBoundCoordinates();
}
$this->bound = $args[0];
} elseif... | php | {
"resource": ""
} |
q261835 | Error.message | test | public function message(string $slug = ''): string
{
$slug = $slug ?: $this->slug();
$messages = $this->messages($slug);
return $messages[0] ?? $this->default_message;
} | php | {
"resource": ""
} |
q261836 | Error.messages | test | public function messages(string $slug = '', bool $by_slug = false): array
{
if (!$slug) { // All messages (i.e., for all slugs)?
//
if ($by_slug) { // All messages keyed by slug?
return $this->errors ?: [$this->default_slug => $this->default_message];
... | php | {
"resource": ""
} |
q261837 | Error.data | test | public function data(string $slug = '', bool $by_slug = false)
{
if (!$slug) { // All data (i.e., for all slugs)?
//
if ($by_slug) { // All data keyed by slug?
return $this->error_data ?: [$this->default_slug => null];
//
} else { // Data f... | php | {
"resource": ""
} |
q261838 | Error.add | test | public function add(string $slug, string $message = '', $data = null)
{
$slug = $slug ?: $this->default_slug;
if (!$message && $slug === $this->default_slug) {
$message = $this->default_message;
} elseif (!$message) { // If empty, base it on slug.
$message = mb_strto... | php | {
"resource": ""
} |
q261839 | Polygon.addCoordinate | test | public function addCoordinate()
{
$args = func_get_args();
if (isset($args[0]) && ($args[0] instanceof Coordinate)) {
$this->coordinates[] = $args[0];
} elseif ((isset($args[0]) && is_numeric($args[0])) && (isset($args[1]) && is_numeric($args[1]))) {
$coordinate = ne... | php | {
"resource": ""
} |
q261840 | PrettyMin.load | test | public function load($html) {
if ($html instanceof \DOMDocument) {
$d = $html;
} elseif ($html instanceof \DOMElement) {
$d = $html->ownerDocument;
} elseif ($html instanceof \SplFileInfo) {
$d = new \DOMDocument();
$d->preserveWhiteSpace = false;
... | php | {
"resource": ""
} |
q261841 | PrettyMin.minify | test | public function minify($options = [])
{
$resolver = new OptionsResolver();
$resolver->setDefaults([
'minify_js' => $this->options['minify_js'],
'minify_css' => $this->options['minify_css'],
'remove_comments' => $this->options['remove_comments'],
'remov... | php | {
"resource": ""
} |
q261842 | PrettyMin.indentRecursive | test | protected function indentRecursive(\DOMNode $currentNode, $depth) {
$indent_characters = $this->options['indent_characters'];
$indentCurrent = true;
$indentChildren = true;
$indentClosingTag = false;
if(($currentNode->nodeType == XML_TEXT_NODE)) {
$indentCurrent = fa... | php | {
"resource": ""
} |
q261843 | InjectOrganizationReferenceListener.postLoad | test | public function postLoad(LifecycleEventArgs $args)
{
$document = $args->getDocument();
if ($document instanceof UserInterface) {
$repository = $args->getDocumentManager()->getRepository('Organizations\Entity\Organization');
$userId = $document->getId();
$referen... | php | {
"resource": ""
} |
q261844 | InviteEmployeeController.createSetPasswordViewModel | test | protected function createSetPasswordViewModel()
{
$organization = $this->getOrganizationEntity();
$result = $this->forward()->dispatch('Auth\Controller\Password', array('action' => 'index'));
$model = new ViewModel(
array(
'organization' => $organizat... | php | {
"resource": ""
} |
q261845 | InviteEmployeeController.getOrganizationEntity | test | protected function getOrganizationEntity()
{
/* @var $orgRepo \Organizations\Repository\Organization */
$orgRepo = $this->orgRepo;
$organiationId = $this->params()->fromQuery('organization');
$organization = $orgRepo->find($organiationId);
return $organization;
} | php | {
"resource": ""
} |
q261846 | InviteEmployeeController.createErrorViewModel | test | protected function createErrorViewModel($message)
{
/* @var $response \Zend\Http\Response */
$response = $this->getResponse();
$response->setStatusCode(500);
$model = new ViewModel(array('message' => $message));
$model->setTemplate('organizations/error/invite');
ret... | php | {
"resource": ""
} |
q261847 | FrontendAsset.add | test | public function add($file, $params = 'footer', $onUnknownExtension = false)
{
RoumenAsset::add($this->elixir($file), $params, $onUnknownExtension);
} | php | {
"resource": ""
} |
q261848 | FrontendAsset.reverseStylesOrder | test | public function reverseStylesOrder($params = 'footer')
{
if (isset(RoumenAsset::$scripts[$params])) {
RoumenAsset::$scripts[$params] = array_reverse(RoumenAsset::$scripts[$params], true);
}
} | php | {
"resource": ""
} |
q261849 | FrontendAsset.addFirst | test | public function addFirst($file, $params = 'footer', $onUnknownExtension = false)
{
RoumenAsset::addFirst($this->elixir($file), $params, $onUnknownExtension);
} | php | {
"resource": ""
} |
q261850 | FrontendAsset.addAfter | test | public function addAfter($file1, $file2, $params = 'footer', $onUnknownExtension = false)
{
RoumenAsset::addAfter($this->elixir($file1), $this->elixir($file2), $params, $onUnknownExtension);
} | php | {
"resource": ""
} |
q261851 | FrontendAsset.addMeta | test | public function addMeta($meta, $data = [])
{
if (is_string($meta)) {
$meta = [$meta => $data];
}
foreach ($meta as $key => $data) {
self::$meta[$key] = $data;
}
} | php | {
"resource": ""
} |
q261852 | FrontendAsset.meta | test | public function meta()
{
foreach(self::$meta as $name => $attributes) {
echo Html::meta()
->name(array_has($attributes, 'config.noname') ? false : $name)
->addAttributes(array_except($attributes, ['config']));
echo "\n";
}
} | php | {
"resource": ""
} |
q261853 | FrontendAsset.controller | test | public function controller($file_extensions, $file)
{
// Only look in a single file extension folder.
if (!is_array($file_extensions)) {
$file_extensions = [$file_extensions];
}
// Replace dots with slashes.
$file = str_replace('.', '/', $file);
if (subs... | php | {
"resource": ""
} |
q261854 | FrontendAsset.loadFile | test | public function loadFile($file_name, $extension, $full_path = '')
{
if (array_has(config('rev-manifest', []), $file_name) || (!empty($full_path) && file_exists($full_path))) {
if (env('APP_ASSET_INLINE', false)) {
if (!isset($this->loaded_inline[$full_path])) {
... | php | {
"resource": ""
} |
q261855 | PaginationQuery.createQuery | test | public function createQuery($params, $queryBuilder)
{
if ($params instanceof Parameters) {
$value = $params->toArray();
} else {
$value = $params;
}
/*
* if user is recruiter or admin
* filter query based on permissions.view
*/
... | php | {
"resource": ""
} |
q261856 | InvitationHandler.process | test | public function process($email)
{
$translator = $this->getTranslator();
if (!$this->validateEmail($email)) {
return array(
'ok' => false,
'message' => $translator->translate('Email address is invalid.')
);
}
$userAndToken... | php | {
"resource": ""
} |
q261857 | InvitationHandler.validateEmail | test | protected function validateEmail($email)
{
if (!$email) {
return false;
}
$validator = $this->getEmailValidator();
return $validator->isValid($email);
} | php | {
"resource": ""
} |
q261858 | InvitationHandler.loadOrCreateUser | test | protected function loadOrCreateUser($email)
{
$repository = $this->getUserRepository();
$generator = $this->getUserTokenGenerator();
/* @var $user \Auth\Entity\User */
$user = $repository->findByEmail(
$email, /*do not check isDraft flag */
null
);
... | php | {
"resource": ""
} |
q261859 | OrganizationReference.load | test | protected function load()
{
if (null !== $this->_type) {
return;
}
// Is the user the owner of the referenced organization?
$org = $this->_repository->findByUser($this->_userId);
if ($org) {
$this->_type = self::TYPE_OWNER;
$this->_organi... | php | {
"resource": ""
} |
q261860 | OrganizationReference.proxy | test | protected function proxy($method)
{
if (!$this->hasAssociation()) {
return $this;
}
$args = array_slice(func_get_args(), 1);
$return = call_user_func_array(array($this->_organization, $method), $args);
return ($return === $this->_organization) ? $this : $return... | php | {
"resource": ""
} |
q261861 | Organization.getHiringOrganizationsCursor | test | public function getHiringOrganizationsCursor(OrganizationInterface $organization)
{
$qb = $this->createQueryBuilder();
$qb->field('parent')->equals($organization->getId());
$qb->field('isDraft')->equals(false);
$q = $qb->getQuery();
$cursor = $q->execute();
return $... | php | {
"resource": ""
} |
q261862 | Organization.findByName | test | public function findByName($name, $create = true)
{
$query = $this->dm->createQueryBuilder('Organizations\Entity\OrganizationName')->hydrate(false)->field('name')->equals($name)->select("_id");
$result = $query->getQuery()->execute()->toArray(false);
if (empty($result) && $create) {
... | php | {
"resource": ""
} |
q261863 | Organization.findByUser | test | public function findByUser($userOrId)
{
$userId = $userOrId instanceof \Auth\Entity\UserInterface ? $userOrId->getId() : $userOrId;
$qb = $this->createQueryBuilder();
/*
* HiringOrganizations also could be associated to the user, but we
* do not want them to be queried... | php | {
"resource": ""
} |
q261864 | Organization.findByEmployee | test | public function findByEmployee($userOrId)
{
$userId = $userOrId instanceof \Auth\Entity\UserInterface ? $userOrId->getId() : $userOrId;
/*
* Employees collection is only set on main organization,
* so here, we do not have to query the "parent" field.
*
* Only sea... | php | {
"resource": ""
} |
q261865 | Organization.createWithName | test | public function createWithName($name)
{
$entity = parent::create();
$repositoryNames = $this->dm->getRepository('Organizations\Entity\OrganizationName');
$entityName = $repositoryNames->create();
$entityName->setName($name);
$entity->setOrganizationName($entityName);
... | php | {
"resource": ""
} |
q261866 | Organization.findDraft | test | public function findDraft($user)
{
if ($user instanceof UserInterface) {
$user = $user->getId();
}
$document = $this->findOneBy(
array(
'isDraft' => true,
'user' => $user
)
);
if (!empty($document)) {
r... | php | {
"resource": ""
} |
q261867 | OrganizationsContactFieldset.init | test | public function init()
{
$this->setName('contact');
$this->add(
array(
'name' => 'street',
'options' => array(
'label' => /* @translate */ 'Street'
)
)
);
$this->add(
... | php | {
"resource": ""
} |
q261868 | Organization.isEmployee | test | public function isEmployee(UserInterface $user)
{
return $this->refs && in_array($user->getId(), $this->refs->getEmployeeIds());
} | php | {
"resource": ""
} |
q261869 | Organization.updatePermissions | test | public function updatePermissions()
{
if ($this->isHiringOrganization()) {
$organization = $this->getParent();
$owner = $organization->getUser();
$this->setUser($owner);
} else {
$organization = $this;
}
/* @var $employees null... | php | {
"resource": ""
} |
q261870 | Organization.setOrganizationName | test | public function setOrganizationName(OrganizationName $organizationName)
{
if (isset($this->organizationName)) {
$this->organizationName->refCounterDec()->refCompanyCounterDec();
}
$this->organizationName = $organizationName;
$this->organizationName->refCounterInc()->refCo... | php | {
"resource": ""
} |
q261871 | Organization.setPermissions | test | public function setPermissions(PermissionsInterface $permissions)
{
// Assure the user has always all rights.
if ($this->user) {
$permissions->grant($this->user, Permissions::PERMISSION_ALL);
}
$this->permissions = $permissions;
return $this;
} | php | {
"resource": ""
} |
q261872 | Organization.getImage | test | public function getImage($key = ImageSet::ORIGINAL)
{
if (is_bool($key)) {
$key = $key ? ImageSet::THUMBNAIL : ImageSet::ORIGINAL;
}
return $this->getImages()->get($key, false) ?: $this->image;
} | php | {
"resource": ""
} |
q261873 | Organization.setContact | test | public function setContact(EntityInterface $contact = null)
{
if (!$contact instanceof OrganizationContact) {
$contact = new OrganizationContact($contact);
}
$this->contact = $contact;
return $this;
} | php | {
"resource": ""
} |
q261874 | Organization.getEmployees | test | public function getEmployees()
{
if ($this->isHiringOrganization()) {
// Always return empty list, as we never have employees in this case.
return new ArrayCollection();
}
if (!$this->employees) {
$this->setEmployees(new ArrayCollection());
}
... | php | {
"resource": ""
} |
q261875 | Organization.getEmployee | test | public function getEmployee($userOrId)
{
$employees = $this->getEmployees();
$userId = $userOrId instanceof \Auth\Entity\UserInterface ? $userOrId->getId() : $userOrId;
foreach ($employees as $employee) {
if ($employee->getUser()->getId() == $userId) {
return ... | php | {
"resource": ""
} |
q261876 | Organization.getEmployeesByRole | test | public function getEmployeesByRole($role)
{
$employees = new ArrayCollection();
/* @var \Organizations\Entity\Employee $employee */
foreach ($this->getEmployees() as $employee) {
if ($role === $employee->getRole()) {
$employees->add($employee);
}
... | php | {
"resource": ""
} |
q261877 | EmployeeInvitationFactory.setCreationOptions | test | public function setCreationOptions(array $options=null)
{
if (!isset($options['user']) || !$options['user'] instanceof UserInterface) {
throw new \InvalidArgumentException('An user interface is required!');
}
if (!isset($options['token']) || !is_string($options['token'])) {
... | php | {
"resource": ""
} |
q261878 | EmployeesFieldset.init | test | public function init()
{
$this->setName('employees');
$this->add(
array(
'name' => 'inviteemployee',
'type' => 'Organizations/InviteEmployeeBar',
'options' => [
'description' => /*@translate*/ 'Invite an employee via email address.',
... | php | {
"resource": ""
} |
q261879 | IndexController.getFormular | test | protected function getFormular($organization)
{
/* @var $container \Organizations\Form\Organizations */
//$services = $this->serviceLocator;
$forms = $this->formManager;
$container = $forms->get(
'Organizations/Form',
array(
'mode' => $organiz... | php | {
"resource": ""
} |
q261880 | Manager.getUri | test | public function getUri(OrganizationImage $image)
{
if ($this->options->getEnabled()) {
return sprintf('%s/%s', $this->options->getUriPath(), $this->getImageSubPath($image));
}
return $image->getUri();
} | php | {
"resource": ""
} |
q261881 | Manager.store | test | public function store(OrganizationImage $image)
{
$resource = $image->getResource();
$path = $this->getImagePath($image);
$this->createDirectoryRecursively(dirname($path));
file_put_contents($path, $resource);
} | php | {
"resource": ""
} |
q261882 | OrganizationHydrator.extract | test | public function extract($object)
{
$result = array();
foreach (self::getReflProperties($object) as $property) {
$propertyName = $property->getName();
if (!$this->filterComposite->filter($propertyName)) {
continue;
}
$getter = 'get' . uc... | php | {
"resource": ""
} |
q261883 | OrganizationHydrator.hydrateValue | test | public function hydrateValue($name, $value, $data = null)
{
if ($this->hasStrategy($name)) {
$strategy = $this->getStrategy($name);
$value = $strategy->hydrate($value, $this->data, $this->object);
}
return $value;
} | php | {
"resource": ""
} |
q261884 | CheckJobCreatePermissionListener.checkCreatePermission | test | public function checkCreatePermission(AssertionEvent $e)
{
/* @var $role \Auth\Entity\User
* @var $organization \Organizations\Entity\OrganizationReference
*/
$role = $e->getRole();
if (!$role instanceof UserInterface) {
return false;
}
$organi... | php | {
"resource": ""
} |
q261885 | LogoImageFactory.configureForm | test | protected function configureForm($form, AbstractOptions $options)
{
$size = $options->getCompanyLogoMaxSize();
$type = $options->getCompanyLogoMimeType();
$form->get($this->fileName)->setViewHelper('formImageUpload')
->setMaxSize($size)
->setAllowedTypes($typ... | php | {
"resource": ""
} |
q261886 | Api.ensureCorrectOrderNumber | test | public function ensureCorrectOrderNumber($orderNumber)
{
if (strlen($orderNumber) > self::ORDER_NUMBER_MAXIMUM_LENGHT) {
throw new LogicException('Payment number can\'t have more than 12 characters');
}
// add 0 to the left in case length of the order number is less than 4
... | php | {
"resource": ""
} |
q261887 | Api.encrypt_3DES | test | private function encrypt_3DES($merchantOrder, $key)
{
$ciphertext = null;
if ( function_exists( 'mcrypt_encrypt' ) && version_compare(phpversion(), '7.1', '<') ) {
// default IV
$bytes = array(0,0,0,0,0,0,0,0); //byte [] IV = {0, 0, 0, 0, 0, 0, 0, 0}
$iv = implo... | php | {
"resource": ""
} |
q261888 | Api.createMerchantSignatureNotif | test | function createMerchantSignatureNotif($key, $data)
{
$key = $this->decodeBase64($key);
$decodec = $this->base64_url_decode($data);
$orderData = json_decode($decodec, true);
$key = $this->encrypt_3DES($orderData['Ds_Order'], $key);
$res = $this->mac256($data, $key);
r... | php | {
"resource": ""
} |
q261889 | Api.validateNotificationSignature | test | public function validateNotificationSignature(array $notification)
{
$notification = ArrayObject::ensureArrayObject($notification);
$notification->validateNotEmpty('Ds_Signature');
$notification->validateNotEmpty('Ds_MerchantParameters');
$data = $notification["Ds_MerchantParameters"... | php | {
"resource": ""
} |
q261890 | Api.sign | test | public function sign(array $params)
{
$base64DecodedKey = base64_decode($this->options['secret_key']);
$key = $this->encrypt_3DES($params['Ds_Merchant_Order'],
$base64DecodedKey);
$res = $this->mac256(
$this->createMerchantParameters($params),
$key
... | php | {
"resource": ""
} |
q261891 | HTTPClient.request | test | public function request( $method, $uri = '', array $options = [] )
{
//
// Add authentication options
//
// Username and password
if (
!empty( $this->authentication_options['username'] )
&& !empty( $this->authentication_options['password'] )
)... | php | {
"resource": ""
} |
q261892 | Ticket.getTicketArticles | test | public function getTicketArticles()
{
$this->clearError();
if ( empty( $this->getID() ) ) {
return [];
}
$ticket_articles = $this->getClient()->resource( ResourceType::TICKET_ARTICLE )->getForTicket( $this->getID() );
if ( !is_array($ticket_articles) ) {
... | php | {
"resource": ""
} |
q261893 | Client.request | test | private function request ( $method, $url, array $url_parameters = [], array $options = [] )
{
$method = mb_strtoupper($method);
if (!empty($url_parameters)) {
$options['query'] = $url_parameters;
}
// Set JSON headers
$options['headers']['Accept'] = 'applica... | php | {
"resource": ""
} |
q261894 | Client.post | test | public function post( $url, array $data = [], array $url_parameters = [] )
{
$response = $this->request(
'POST',
$url,
$url_parameters,
[ 'json' => $data, ]
);
return $response;
} | php | {
"resource": ""
} |
q261895 | Client.put | test | public function put( $url, array $data = [], array $url_parameters = [] )
{
$response = $this->request(
'PUT',
$url,
$url_parameters,
[ 'json' => $data, ]
);
return $response;
} | php | {
"resource": ""
} |
q261896 | TicketArticle.getForTicket | test | public function getForTicket($ticket_id)
{
if ( !empty( $this->getValues() ) ) {
throw new \RuntimeException('Object already contains values, getForTicket() not possible, use a new object');
}
$this->clearError();
$ticket_id = intval($ticket_id);
if ( empty($tic... | php | {
"resource": ""
} |
q261897 | AbstractResource.getValue | test | public function getValue($key)
{
if ( array_key_exists( $key, $this->values ) ) {
return $this->values[$key];
}
$remote_data = $this->getRemoteData();
if ( array_key_exists( $key, $remote_data ) ) {
return $remote_data[$key];
}
return null;
... | php | {
"resource": ""
} |
q261898 | AbstractResource.get | test | public function get($object_id)
{
if ( !empty( $this->getValues() ) ) {
throw new AlreadyFetchedObjectException('Object already contains values, get() not possible, use a new object');
}
if ( empty($object_id) ) {
throw new \RuntimeException('Missing object ID');
... | php | {
"resource": ""
} |
q261899 | AbstractResource.all | test | public function all( $page = null, $objects_per_page = null )
{
if ( !empty( $this->getValues() ) ) {
throw new AlreadyFetchedObjectException('Object already contains values, all() not possible, use a new object');
}
if ( isset($page) && $page <= 0 ) {
throw new \Run... | php | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.