Commit afea9c32 authored by Pavel's avatar Pavel
Browse files

init

parents
Loading
Loading
Loading
Loading

.gitignore

0 → 100644
+5 −0
Original line number Diff line number Diff line
.DS_Store
/composer.lock
/vendor/
/.idea/
 No newline at end of file

composer.json

0 → 100644
+28 −0
Original line number Diff line number Diff line
{
  "name": "iqdev/search-dc",
  "description": "Declaring the search structure",
  "minimum-stability": "stable",
  "license": "proprietary",
  "authors": [
    {
      "name": "Pavel Piligrimov",
      "email": "p.piligrimov@iqdev.digital"
    }
  ],
  "version": "0.0.1",
  "type": "library",
  "keywords": [
    "search",
    "declaring",
    "php"
  ],
  "require": {
    "php": ">=7.4",
    "ramsey/collection": "^1.2"
  },
  "autoload": {
    "psr-4": {
      "IQDEV\\Search\\": "src/Search/"
    }
  }
}
+15 −0
Original line number Diff line number Diff line
<?php

namespace IQDEV\Search\Document;

final class Document
{
    public string $id;
    public array $data;

    public function __construct(string $id, array $data)
    {
        $this->id   = $id;
        $this->data = $data;
    }
}
+21 −0
Original line number Diff line number Diff line
<?php

namespace IQDEV\Search\Document;

use Ramsey\Collection\AbstractArray;
use Ramsey\Collection\AbstractCollection;
use Ramsey\Collection\CollectionInterface;


/**
 * @extends AbstractArray<Document>
 * @implements CollectionInterface<Document>
 */
final class DocumentCollection extends AbstractCollection
{
    public function getType(): string
    {
        return Document::class;
    }
}
 No newline at end of file
+40 −0
Original line number Diff line number Diff line
<?php

namespace IQDEV\Search\Facet;

final class Facet
{
    private FacetType $type;
    private string $code;
    private ?string $label = null;
    public FacetItemCollection $items;
    private int $position = 0;

    public function __construct(FacetType $type, string $code)
    {
        $this->type  = $type;
        $this->code  = $code;
        $this->items = new FacetItemCollection();
    }

    public function getLabel(): ?string
    {
        return $this->label;
    }

    public function getType(): FacetType
    {
        return $this->type;
    }

    public function getCode(): string
    {
        return $this->code;
    }

    public function getPosition(): int
    {
        return $this->position;
    }
}
 No newline at end of file