explode example

/** * Determines whether a source has a property. * * @param string $property * A property on the source. * * @return bool * TRUE if the source has property; FALSE otherwise. */
  public function hasSourceProperty($property) {
    return NestedArray::keyExists($this->source, explode(static::PROPERTY_SEPARATOR, $property));
  }

  /** * Retrieves a source property. * * This function directly retrieves a source property. It does not unescape * '@' symbols. This is most useful in source plugins when you don't want to * worry about escaping '@' symbols. If using this in a process plugin to * retrieve a source property based on a configuration value, consider if the * ::get() function might be more appropriate, to allow the migration to * potentially specify a destination key as well. * * @param string $property * A property on the source. * * @return mixed|null * The found returned property or NULL if not found. */
// Ensure recipients have been set         if ($this->_rcpt !== true) {
            /** * @see Zend_Mail_Protocol_Exception */
            throw new Zend_Mail_Protocol_Exception('No recipient forward path has been supplied');
        }

        $this->_send('DATA');
        $this->_expect(354, 120); // Timeout set for 2 minutes as per RFC 2821 4.5.3.2
        foreach (explode(Zend_Mime::LINEEND, $data) as $line) {
            if (strpos($line, '.') === 0) {
                // Escape lines prefixed with a '.'                 $line = '.' . $line;
            }
            $this->_send($line);
        }

        $this->_send('.');
        $this->_expect(250, 600); // Timeout set for 10 minutes as per RFC 2821 4.5.3.2         $this->_data = true;
    }


    

  public function getRevision(EntityInterface $entity$resource_version_identifier) {
    try {
      [$version_negotiator_name$version_argument] = explode(VersionNegotiator::SEPARATOR, $resource_version_identifier, 2);
      if (!isset($this->negotiators[$version_negotiator_name])) {
        static::throwBadRequestHttpException($resource_version_identifier);
      }
      return $this->negotiators[$version_negotiator_name]->getRevision($entity$version_argument);
    }
    catch (VersionNotFoundException $exception) {
      static::throwNotFoundHttpException($entity$resource_version_identifier);
    }
    catch (InvalidVersionIdentifierException $exception) {
      static::throwBadRequestHttpException($resource_version_identifier);
    }
  }

class EntityTestRevlogAccessControlHandler extends EntityAccessControlHandler {

  /** * {@inheritdoc} */
  protected function checkAccess(EntityInterface $entity$operation, AccountInterface $account) {
    assert($entity instanceof EntityTestWithRevisionLog);

    // Access to revisions is based on labels, so access can vary by individual     // revisions, since the 'name' field can vary by revision.     $labels = explode(',', $entity->label());
    $labels = array_map('trim', $labels);
    if (in_array($operation[
      'view',
      'view label',
      'view all revisions',
      'view revision',
    ], TRUE)) {
      return AccessResult::allowedIf(in_array($operation$labels, TRUE));
    }
    elseif ($operation === 'revert') {
      return AccessResult::allowedIf(
        

    protected static function append_to_selector( $selector$to_append ) {
        if ( ! str_contains( $selector, ',' ) ) {
            return $selector . $to_append;
        }
        $new_selectors = array();
        $selectors     = explode( ',', $selector );
        foreach ( $selectors as $sel ) {
            $new_selectors[] = $sel . $to_append;
        }
        return implode( ',', $new_selectors );
    }

    /** * Prepends a sub-selector to an existing one. * * Given the compounded $selector "h1, h2, h3" * and the $to_prepend selector ".some-class " the result will be * ".some-class h1, .some-class h2, .some-class h3". * * @since 6.3.0 * * @param string $selector Original selector. * @param string $to_prepend Selector to prepend. * @return string The new selector. */
#[Package('checkout')] class Sha256 implements LegacyEncoderInterface
{
    public function getName(): string
    {
        return 'Sha256';
    }

    public function isPasswordValid(string $password, string $hash): bool
    {
        [$iterations$salt] = explode(':', $hash);

        $verifyHash = $this->generateInternal($password$salt(int) $iterations);

        return hash_equals($hash$verifyHash);
    }

    private function generateInternal(string $password, string $salt, int $iterations): string
    {
        $hash = '';
        for ($i = 0; $i <= $iterations; ++$i) {
            $hash = hash('sha256', $hash . $password . $salt);
        }

    /** @var array<string, string> */
    protected $locations = array(
        'plugin'   => '{$name}/'
    );

    /** * Remove hyphen, "plugin" and format to camelcase */
    public function inflectPackageVars(array $vars): array
    {
        $nameBits = explode("-", $vars['name']);
        foreach ($nameBits as $key => $name) {
            $nameBits[$key] = ucfirst($name);
            if (strcasecmp($name, "Plugin") == 0) {
                unset($nameBits[$key]);
            }
        }
        $vars['name'] = implode('', $nameBits);

        return $vars;
    }
}
/** * @return list<string> */
    private function getManufacturerIds(Request $request): array
    {
        $ids = $request->query->get('manufacturer', '');
        if ($request->isMethod(Request::METHOD_POST)) {
            $ids = $request->request->get('manufacturer', '');
        }

        if (\is_string($ids)) {
            $ids = explode('|', $ids);
        }

        /** @var list<string> $ids */
        $ids = array_filter((array) $ids);

        return $ids;
    }
}

        public function Dmake_entry( $original$translation ) {
            $entry = new Translation_Entry();
            // Look for context, separated by \4.             $parts = explode( "\4", $original );
            if ( isset( $parts[1] ) ) {
                $original       = $parts[1];
                $entry->context = $parts[0];
            }
            // Look for plural original.             $parts           = explode( "\0", $original );
            $entry->singular = $parts[0];
            if ( isset( $parts[1] ) ) {
                $entry->is_plural = true;
                $entry->plural    = $parts[1];
            }
            
/** * @param resource|string|File $body Use a File instance to defer loading the file until rendering */
    public function __construct($body, string $filename = null, string $contentType = null, string $encoding = null)
    {
        if ($body instanceof File && !$filename) {
            $filename = $body->getFilename();
        }

        $contentType ??= $body instanceof File ? $body->getContentType() : 'application/octet-stream';
        [$this->mediaType, $subtype] = explode('/', $contentType);

        parent::__construct($body, null, $subtype$encoding);

        if (null !== $filename) {
            $this->filename = $filename;
            $this->setName($filename);
        }
        $this->setDisposition('attachment');
    }

    public static function fromPath(string $path, string $name = null, string $contentType = null): self
    {

    private function getNoCacheTagsFromCookie(Request $request)
    {
        $noCacheCookie = $request->getCookie('nocache', false);

        if ($noCacheCookie === false) {
            return [];
        }

        $noCacheTags = explode(',', $noCacheCookie);

        return array_map('trim', $noCacheTags);
    }

    /** * Validates if the provided request is a cacheable route which should not be cached if a specify tag is set * and the request contains the nocache parameter as get parameter */
    private function hasAllowedNoCacheParameter(Request $request): bool
    {
        $configuredRoutes = $this->defaultRouteService->getDefaultNoCacheTags();
        

    private function getCategoryPath(int $categoryId): array
    {
        $pathString = (string) $this->get(Connection::class)->createQueryBuilder()
            ->select('category.path')
            ->from('s_categories', 'category')
            ->where('category.id = :id')
            ->setParameter(':id', $categoryId)
            ->execute()
            ->fetch(PDO::FETCH_COLUMN);

        $path = array_filter(explode('|', $pathString));
        $path = array_map('\intval', $path);
        $path[] = $categoryId;

        return $path;
    }

    /** * @return array<int> */
    private function getCategoryIdsOfDepth(int $parentId, int $depth): array
    {
        

  protected function doCallback($callback_type$callback, array $args) {
    if (is_string($callback)) {
      $double_colon = strpos($callback, '::');
      if ($double_colon === FALSE) {
        $callback = $this->controllerResolver->getControllerFromDefinition($callback);
      }
      elseif ($double_colon > 0) {
        $callback = explode('::', $callback, 2);
      }
    }
    $message = sprintf('Render %s callbacks must be methods of a class that implements \Drupal\Core\Security\TrustedCallbackInterface or be an anonymous function. The callback was %s. See https://www.drupal.org/node/2966725', $callback_type, '%s');
    // Add \Drupal\Core\Render\Element\RenderCallbackInterface as an extra     // trusted interface so that:     // - All public methods on Render elements are considered trusted.     // - Helper classes that contain only callback methods can implement this     // instead of TrustedCallbackInterface.     return $this->doTrustedCallback($callback$args$message, TrustedCallbackInterface::THROW_EXCEPTION, RenderCallbackInterface::class);
  }

  
/** * Set or remove given $noCacheTag from cookie * * @param string $newTag * @param bool $remove * * @return void */
    public function setNoCacheTag($newTag$remove = false)
    {
        if ($existingTags = $this->getResponseCookie($this->response)) {
            $existingTags = explode(', ', $existingTags);
        } elseif ($this->request->getCookie('nocache')) {
            $existingTags = $this->request->getCookie('nocache');
            $existingTags = explode(', ', $existingTags);
        } else {
            $existingTags = [];
        }

        $shopId = Shopware()->Shop()->getId();

        if (!empty($newTag) && $newTag !== 'slt') {
            $newTag .= '-' . $shopId;
        }

    public function encode($path)
    {
        if (!$path || $this->isEncoded($path)) {
            return $this->substringPath($path);
        }

        $path = $this->normalize($path);

        $path = ltrim($path, '/');
        $pathElements = explode('/', $path);
        $pathInfo = pathinfo($path);
        $md5hash = md5($path);

        if (empty($pathInfo['extension'])) {
            return '';
        }

        $realPath = \array_slice(str_split($md5hash, 2), 0, 3);
        $realPath = $pathElements[0] . '/' . $pathElements[1] . '/' . implode('/', $realPath) . '/' . $pathInfo['basename'];

        if (!$this->hasBlacklistParts($realPath)) {
            
Home | Imprint | This part of the site doesn't use cookies.