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
2declare(strict_types=1);
3/**
4 * Pop PHP Framework (https://www.popphp.org/)
5 *
6 * @link       https://github.com/popphp/popphp-framework
7 * @author     Nick Sagona, III <nick@popphp.org>
8 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
9 * @license    https://www.popphp.org/license     New BSD License
10 */
11
12/**
13 * @namespace
14 */
15namespace Pop\Utils;
16
17/**
18 * Pop utils callable interface
19 *
20 * @category   Pop
21 * @package    Pop\Utils
22 * @author     Nick Sagona, III <nick@popphp.org>
23 * @copyright  Copyright (c) 2009-2026 Nick Sagona, III
24 * @license    https://www.popphp.org/license     New BSD License
25 * @version    3.0.0
26 */
27interface CallableInterface
28{
29
30    /**
31     * Set callable
32     *
33     * @param  mixed $callable
34     * @return CallableInterface
35     */
36    public function setCallable(mixed $callable): CallableInterface;
37
38    /**
39     * Get callable
40     *
41     * @return mixed
42     */
43    public function getCallable(): mixed;
44
45    /**
46     * Get callable type
47     *
48     * @return ?string
49     */
50    public function getCallableType(): ?string;
51
52    /**
53     * Set parameters
54     *
55     * @param  array $parameters
56     * @return CallableInterface
57     */
58    public function setParameters(array $parameters): CallableInterface;
59
60    /**
61     * Add parameters
62     *
63     * @param  array $parameters
64     * @return CallableInterface
65     */
66    public function addParameters(array $parameters): CallableInterface;
67
68    /**
69     * Add a parameter
70     *
71     * @param  mixed $parameter
72     * @return CallableInterface
73     */
74    public function addParameter(mixed $parameter): CallableInterface;
75
76    /**
77     * Add a parameter
78     *
79     * @param  string $name
80     * @param  mixed  $parameter
81     * @return CallableInterface
82     */
83    public function addNamedParameter(string $name, mixed $parameter): CallableInterface;
84
85    /**
86     * Get parameters
87     *
88     * @return array
89     */
90    public function getParameters(): array;
91
92    /**
93     * Get a parameter
94     *
95     * @param  string $key
96     * @return mixed
97     */
98    public function getParameter(string $key): mixed;
99
100    /**
101     * Has parameters
102     *
103     * @return bool
104     */
105    public function hasParameters(): bool;
106
107    /**
108     * Has a parameter
109     *
110     * @param  string $key
111     * @return bool
112     */
113    public function hasParameter(string $key): bool;
114
115    /**
116     * Remove a parameter
117     *
118     * @param  string $key
119     * @return CallableInterface
120     */
121    public function removeParameter(string $key): CallableInterface;
122
123    /**
124     * Remove all parameters
125     *
126     * @return CallableInterface
127     */
128    public function removeParameters(): CallableInterface;
129
130    /**
131     * Set constructor parameters for instance call
132     *
133     * @param  array $constructorParams
134     * @return CallableInterface
135     */
136    public function setConstructorParams(array $constructorParams): CallableInterface;
137
138    /**
139     * Get constructor parameters for instance call
140     *
141     * @return array
142     */
143    public function getConstructorParams(): array;
144
145    /**
146     * Get a constructor parameter for instance call
147     *
148     * @param  string $key
149     * @return mixed
150     */
151    public function getConstructorParam(string $key): mixed;
152
153    /**
154     * Has constructor parameters for instance call
155     *
156     * @return bool
157     */
158    public function hasConstructorParams(): bool;
159
160    /**
161     * Has a constructor parameter for instance call
162     *
163     * @param  string $key
164     * @return bool
165     */
166    public function hasConstructorParam(string $key): bool;
167
168    /**
169     * Remove a constructor parameter for instance call
170     *
171     * @param  string $key
172     * @return CallableInterface
173     */
174    public function removeConstructorParam(string $key): CallableInterface;
175
176    /**
177     * Remove all constructor parameters for instance call
178     *
179     * @return CallableInterface
180     */
181    public function removeConstructorParams(): CallableInterface;
182
183    /**
184     * Check if object is callable
185     *
186     * @return bool
187     */
188    public function isCallable(): bool;
189
190    /**
191     * Check if object was called
192     *
193     * @return bool
194     */
195    public function wasCalled(): bool;
196
197    /**
198     * Prepare object for call
199     *
200     * @return CallableInterface
201     */
202    public function prepare(): CallableInterface;
203
204    /**
205     * Prepare parameters
206     *
207     * @return CallableInterface
208     */
209    public function prepareParameters(): CallableInterface;
210
211    /**
212     * Execute the call
213     *
214     * @param  mixed $parameters
215     * @return mixed
216     */
217    public function call(mixed $parameters = null): mixed;
218
219}