ICanBoogie/Facets v0.3.1
  • Namespace
  • Class

Namespaces

  • ICanBoogie
    • Facets
      • RecordCollection

Classes

  • BooleanCriterion
  • Criterion
  • CriterionList
  • CriterionNotDefined
  • CriterionValue
  • Fetcher
  • IntervalCriterionValue
  • QueryString
  • QueryStringWord
  • RecordCollection
  • SetCriterionValue

Interfaces

  • CriterionInterface
  • FetcherInterface

Traits

  • CriterionTrait
  • FetcherTrait
  • HumanizePairsTrait
  • ParseQueryStringTrait
 1  2  3  4  5  6  7  8  9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 
<?php

/*
 * This file is part of the ICanBoogie package.
 *
 * (c) Olivier Laviale <olivier.laviale@gmail.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace ICanBoogie\Facets;

use ICanBoogie\Accessor\AccessorTrait;

/**
 * Representation of a query string word.
 *
 * @property-read string $normalized The normalized word.
 * @property-read QueryStringWord|null $previous Previous query string word, if any.
 * @property-read QueryStringWord|null $next Next query string word, if any.
 */
class QueryStringWord
{
    use AccessorTrait;

    public $match = [];

    /**
     * @var string
     */
    protected $word;

    /**
     * Normalized {@link $word}.
     *
     * @var string
     */
    protected $normalized;

    protected function get_normalized()
    {
        return $this->normalized;
    }

    protected $q;

    /**
     * @return QueryStringWord|null
     */
    protected function get_previous()
    {
        return $this->q->before($this);
    }

    /**
     * @return QueryStringWord|null
     */
    protected function get_next()
    {
        return $this->q->after($this);
    }

    public function __construct($word, QueryString $q)
    {
        $this->word = $word;
        $this->normalized = \ICanboogie\normalize($word);
        $this->q = $q;
    }

    /**
     * Returns the query string word.
     *
     * @return string
     */
    public function __toString()
    {
        return $this->word;
    }
}
ICanBoogie/Facets v0.3.1 API documentation generated by ApiGen