Adds more classes, and refactoring to the search feature. Adds test search to search page. #952

This commit is contained in:
2022-09-16 23:41:41 +02:00
parent d757e14fac
commit c53ece2a2d
22 changed files with 845 additions and 91 deletions

View File

@@ -60,6 +60,7 @@ interface FindInterface
* @return void
* @since 3.2.0
*/
public function reset(?string $table = null);
public function reset(?string $table = null);
}

View File

@@ -34,15 +34,15 @@ interface ModelInterface
/**
* Model the values of an item
* Example: $this->item('table_name', Object);
* Example: $this->item(Object, 'table_name');
*
* @param string $table The table
* @param object $item The item object
* @param object $item The item object
* @param string|null $table The table
*
* @return object
* @return object|null
* @since 3.2.0
*/
public function item(object $item, ?string $table = null): object;
public function item(object $item, ?string $table = null): ?object;
/**
* Model the values of multiple items

View File

@@ -0,0 +1,56 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Search\Interfaces;
/**
* Search Interface
*
* @since 3.2.0
*/
interface SearchInterface
{
/**
* Get found values
*
* @param string $table The table being searched
*
* @return array|null
* @since 3.2.0
*/
public function get(string $table): ?array;
/**
* Search inside a value
*
* @param mixed $value The field value
* @param int $id The item ID
* @param string $field The field key
* @param string $table The table
*
* @return bool
* @since 3.2.0
*/
public function value($value, int $id, string $field, string $table): bool;
/**
* Empty the found values
*
* @param string $table The table being searched
*
* @return void
* @since 3.2.0
*/
public function reset(string $table);
}

View File

@@ -0,0 +1,43 @@
<?php
/**
* @package Joomla.Component.Builder
*
* @created 30th April, 2015
* @author Llewellyn van der Merwe <https://dev.vdm.io>
* @git Joomla Component Builder <https://git.vdm.dev/joomla/Component-Builder>
* @copyright Copyright (C) 2015 Vast Development Method. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
namespace VDM\Joomla\Componentbuilder\Search\Interfaces;
/**
* Search Type Interface
*
* @since 3.2.0
*/
interface SearchTypeInterface
{
/**
* Search inside a string
*
* @param string $value The string value
*
* @return string|null The marked string if found, else null
* @since 3.2.0
*/
public function string(string $value): ?string;
/**
* Replace found instances inside string value
*
* @param string $value The string value to update
*
* @return string The updated string
* @since 3.2.0
*/
public function replace(string $value): string;
}