summaryrefslogtreecommitdiffstats
path: root/vendor/ipl/stdlib/src/Contract
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/ipl/stdlib/src/Contract')
-rw-r--r--vendor/ipl/stdlib/src/Contract/Filterable.php63
-rw-r--r--vendor/ipl/stdlib/src/Contract/Paginatable.php56
-rw-r--r--vendor/ipl/stdlib/src/Contract/PaginationInterface.php8
-rw-r--r--vendor/ipl/stdlib/src/Contract/PluginLoader.php21
-rw-r--r--vendor/ipl/stdlib/src/Contract/Translator.php65
-rw-r--r--vendor/ipl/stdlib/src/Contract/Validator.php22
-rw-r--r--vendor/ipl/stdlib/src/Contract/ValidatorInterface.php8
7 files changed, 243 insertions, 0 deletions
diff --git a/vendor/ipl/stdlib/src/Contract/Filterable.php b/vendor/ipl/stdlib/src/Contract/Filterable.php
new file mode 100644
index 0000000..2a6316a
--- /dev/null
+++ b/vendor/ipl/stdlib/src/Contract/Filterable.php
@@ -0,0 +1,63 @@
+<?php
+
+namespace ipl\Stdlib\Contract;
+
+use ipl\Stdlib\Filter;
+
+interface Filterable
+{
+ /**
+ * Get the filter of the query
+ *
+ * @return Filter\Chain
+ */
+ public function getFilter();
+
+ /**
+ * Add a filter to the query
+ *
+ * Note that this method does not override an already set filter. Instead, multiple calls to this function add
+ * the specified filter using a {@see Filter\All} chain.
+ *
+ * @param Filter\Rule $filter
+ *
+ * @return $this
+ */
+ public function filter(Filter\Rule $filter);
+
+ /**
+ * Add a filter to the query
+ *
+ * Note that this method does not override an already set filter. Instead, multiple calls to this function add
+ * the specified filter using a {@see Filter\Any} chain.
+ *
+ * @param Filter\Rule $filter
+ *
+ * @return $this
+ */
+ public function orFilter(Filter\Rule $filter);
+
+ /**
+ * Add a filter to the query
+ *
+ * Note that this method does not override an already set filter. Instead, multiple calls to this function add
+ * the specified filter wrapped by a {@see Filter\None} chain and using a {@see Filter\All} chain.
+ *
+ * @param Filter\Rule $filter
+ *
+ * @return $this
+ */
+ public function notFilter(Filter\Rule $filter);
+
+ /**
+ * Add a filter to the query
+ *
+ * Note that this method does not override an already set filter. Instead, multiple calls to this function add
+ * the specified filter wrapped by a {@see Filter\None} chain and using a {@see Filter\Any} chain.
+ *
+ * @param Filter\Rule $filter
+ *
+ * @return $this
+ */
+ public function orNotFilter(Filter\Rule $filter);
+}
diff --git a/vendor/ipl/stdlib/src/Contract/Paginatable.php b/vendor/ipl/stdlib/src/Contract/Paginatable.php
new file mode 100644
index 0000000..3e2a4ee
--- /dev/null
+++ b/vendor/ipl/stdlib/src/Contract/Paginatable.php
@@ -0,0 +1,56 @@
+<?php
+
+namespace ipl\Stdlib\Contract;
+
+use Countable;
+
+interface Paginatable extends Countable
+{
+ /**
+ * Get whether a limit is set
+ *
+ * @return bool
+ */
+ public function hasLimit();
+
+ /**
+ * Get the limit
+ *
+ * @return int|null
+ */
+ public function getLimit();
+
+ /**
+ * Set the limit
+ *
+ * @param int|null $limit Maximum number of items to return. If you want to disable the limit,
+ * it is best practice to use null or a negative value
+ *
+ * @return $this
+ */
+ public function limit($limit);
+
+ /**
+ * Get whether an offset is set
+ *
+ * @return bool
+ */
+ public function hasOffset();
+
+ /**
+ * Get the offset
+ *
+ * @return int|null
+ */
+ public function getOffset();
+
+ /**
+ * Set the offset
+ *
+ * @param int|null $offset Start result set after this many rows. If you want to disable the offset,
+ * it is best practice to use null or a negative value
+ *
+ * @return $this
+ */
+ public function offset($offset);
+}
diff --git a/vendor/ipl/stdlib/src/Contract/PaginationInterface.php b/vendor/ipl/stdlib/src/Contract/PaginationInterface.php
new file mode 100644
index 0000000..b00fa66
--- /dev/null
+++ b/vendor/ipl/stdlib/src/Contract/PaginationInterface.php
@@ -0,0 +1,8 @@
+<?php
+
+namespace ipl\Stdlib\Contract;
+
+/** @deprecated Use {@link Paginatable} instead */
+interface PaginationInterface extends Paginatable
+{
+}
diff --git a/vendor/ipl/stdlib/src/Contract/PluginLoader.php b/vendor/ipl/stdlib/src/Contract/PluginLoader.php
new file mode 100644
index 0000000..1be779c
--- /dev/null
+++ b/vendor/ipl/stdlib/src/Contract/PluginLoader.php
@@ -0,0 +1,21 @@
+<?php
+
+namespace ipl\Stdlib\Contract;
+
+/**
+ * Representation of plugin loaders
+ *
+ * Plugin loaders must implement the {@link load()} method in order to provide the fully qualified class name of a
+ * plugin to load.
+ */
+interface PluginLoader
+{
+ /**
+ * Load the class file for a given plugin name
+ *
+ * @param string $name Name of the plugin
+ *
+ * @return string|false FQN of the plugin's class if found, false otherwise
+ */
+ public function load($name);
+}
diff --git a/vendor/ipl/stdlib/src/Contract/Translator.php b/vendor/ipl/stdlib/src/Contract/Translator.php
new file mode 100644
index 0000000..85ab515
--- /dev/null
+++ b/vendor/ipl/stdlib/src/Contract/Translator.php
@@ -0,0 +1,65 @@
+<?php
+
+namespace ipl\Stdlib\Contract;
+
+/**
+ * Representation of translators
+ */
+interface Translator
+{
+ /**
+ * Translate a message
+ *
+ * @param string $message
+ * @param string $context Message context
+ *
+ * @return string Translated message or original message if no translation is found
+ */
+ public function translate($message, $context = null);
+
+ /**
+ * Translate a message in the given domain
+ *
+ * If no translation is found in the specified domain, the translation is also searched for in the default domain.
+ *
+ * @param string $domain
+ * @param string $message
+ * @param string $context Message context
+ *
+ * @return string Translated message or original message if no translation is found
+ */
+ public function translateInDomain($domain, $message, $context = null);
+
+ /**
+ * Translate a plural message
+ *
+ * The returned message is based on the given number to decide between the singular and plural forms.
+ * That is also the case if no translation is found.
+ *
+ * @param string $singular Singular message
+ * @param string $plural Plural message
+ * @param int $number Number to decide between the returned singular and plural forms
+ * @param string $context Message context
+ *
+ * @return string Translated message or original message if no translation is found
+ */
+ public function translatePlural($singular, $plural, $number, $context = null);
+
+ /**
+ * Translate a plural message in the given domain
+ *
+ * If no translation is found in the specified domain, the translation is also searched for in the default domain.
+ *
+ * The returned message is based on the given number to decide between the singular and plural forms.
+ * That is also the case if no translation is found.
+ *
+ * @param string $domain
+ * @param string $singular Singular message
+ * @param string $plural Plural message
+ * @param int $number Number to decide between the returned singular and plural forms
+ * @param string $context Message context
+ *
+ * @return string Translated message or original message if no translation is found
+ */
+ public function translatePluralInDomain($domain, $singular, $plural, $number, $context = null);
+}
diff --git a/vendor/ipl/stdlib/src/Contract/Validator.php b/vendor/ipl/stdlib/src/Contract/Validator.php
new file mode 100644
index 0000000..c03efab
--- /dev/null
+++ b/vendor/ipl/stdlib/src/Contract/Validator.php
@@ -0,0 +1,22 @@
+<?php
+
+namespace ipl\Stdlib\Contract;
+
+interface Validator
+{
+ /**
+ * Get whether the given value is valid
+ *
+ * @param mixed $value
+ *
+ * @return bool
+ */
+ public function isValid($value);
+
+ /**
+ * Get the validation error messages
+ *
+ * @return array
+ */
+ public function getMessages();
+}
diff --git a/vendor/ipl/stdlib/src/Contract/ValidatorInterface.php b/vendor/ipl/stdlib/src/Contract/ValidatorInterface.php
new file mode 100644
index 0000000..36cf55e
--- /dev/null
+++ b/vendor/ipl/stdlib/src/Contract/ValidatorInterface.php
@@ -0,0 +1,8 @@
+<?php
+
+namespace ipl\Stdlib\Contract;
+
+/** @deprecated Use {@link Validator} instead */
+interface ValidatorInterface extends Validator
+{
+}