Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
1<?php
2
3/**
4 * Command interface definition.
5 *
6 * PHP version 8
7 *
8 * Copyright (C) Villanova University 2013.
9 * Copyright (C) The National Library of Finland 2021.
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2,
13 * as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU General Public License for more details.
19 *
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software
22 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
23 *
24 * @category VuFind
25 * @package  Search
26 * @author   David Maus <maus@hab.de>
27 * @author   Aleksi Peebles <aleksi.peebles@helsinki.fi>
28 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
29 * @link     https://vufind.org
30 */
31
32namespace VuFindSearch\Command;
33
34use VuFindSearch\Backend\BackendInterface;
35use VuFindSearch\Exception\LogicException;
36use VuFindSearch\ParamBag;
37
38/**
39 * Command interface definition.
40 *
41 * @category VuFind
42 * @package  Search
43 * @author   David Maus <maus@hab.de>
44 * @author   Aleksi Peebles <aleksi.peebles@helsinki.fi>
45 * @license  http://opensource.org/licenses/gpl-2.0.php GNU General Public License
46 * @link     https://vufind.org
47 */
48interface CommandInterface
49{
50    /**
51     * Return target backend identifier.
52     *
53     * @return string
54     */
55    public function getTargetIdentifier(): string;
56
57    /**
58     * Execute command on backend.
59     *
60     * @param BackendInterface $backend Backend
61     *
62     * @return CommandInterface Command instance for method chaining
63     */
64    public function execute(BackendInterface $backend): CommandInterface;
65
66    /**
67     * Was the command executed?
68     *
69     * @return bool
70     */
71    public function isExecuted(): bool;
72
73    /**
74     * Return result of executed operation.
75     *
76     * @throws LogicException Command was not yet executed
77     *
78     * @return mixed
79     */
80    public function getResult();
81
82    /**
83     * Return search parameters.
84     *
85     * @return ParamBag
86     */
87    public function getSearchParameters(): ParamBag;
88
89    /**
90     * Return command context.
91     *
92     * @return mixed
93     */
94    public function getContext();
95}