// Import framework stuff
use Org\Mxchange\CoreFramework\Criteria\BaseCriteria;
-use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
use Org\Mxchange\CoreFramework\Criteria\Storing\StoreableCriteria;
use Org\Mxchange\CoreFramework\Generic\FrameworkInterface;
+use Org\Mxchange\CoreFramework\Traits\Criteria\Local\LocalSearchCriteriaTrait;
// Import SPL stuff
use \BadMethodCallException;
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class DataSetCriteria extends BaseCriteria implements StoreableCriteria {
+ // Load traits
+ use LocalSearchCriteriaTrait;
+
/**
* Table name
*/
*/
private $primaryKeys = [];
- /**
- * Search criteria instance
- */
- private $searchInstance = NULL;
-
/**
* Protected constructor
*
return $this->primaryKeys;
}
- /**
- * Setter for search instance
- *
- * @param $searchInstance Searchable criteria instance
- * @return void
- */
- public final function setSearchInstance (LocalSearchCriteria $searchInstance) {
- $this->searchInstance = $searchInstance;
- }
-
- /**
- * Getter for search instance
- *
- * @return $searchInstance Searchable criteria instance
- */
- public final function getSearchInstance () {
- return $this->searchInstance;
- }
-
/**
* Getter for unique key value
*
// Import framework stuff
use Org\Mxchange\CoreFramework\Criteria\BaseCriteria;
-use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
+use Org\Mxchange\CoreFramework\Traits\Criteria\Local\LocalSearchCriteriaTrait;
use Org\Mxchange\CoreFramework\Criteria\Local\LocalUpdateCriteria;
/**
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
class UpdateCriteria extends BaseCriteria implements LocalUpdateCriteria {
- /**
- * Search criteria instance
- */
- private $searchInstance = NULL;
+ // Load traits
+ use LocalSearchCriteriaTrait;
/**
* Protected constructor
return $this->getCriteriaArray();
}
- /**
- * Setter for search instance
- *
- * @param $searchInstance Searchable criteria instance
- * @return void
- */
- public final function setSearchInstance (LocalSearchCriteria $searchInstance) {
- $this->searchInstance = $searchInstance;
- }
-
- /**
- * Getter for search instance
- *
- * @return $searchInstance Searchable criteria instance
- */
- public final function getSearchInstance () {
- return $this->searchInstance;
- }
-
}
--- /dev/null
+<?php
+// Own namespace
+namespace Org\Mxchange\CoreFramework\Traits\Criteria\Search;
+
+// Import application-specific stuff
+use Org\Mxchange\CoreFramework\Criteria\Local\LocalSearchCriteria;
+
+/**
+ * A trait for local storage criteria instances
+ *
+ * @author Roland Haeder <webmaster@shipsimu.org>
+ * @version 0.0.0
+ * @copyright Copyright (c) 2007, 2008 Roland Haeder, 2009 - 2023 Core Developer Team
+ * @license GNU GPL 3.0 or any newer version
+ * @link http://www.shipsimu.org
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+trait LocalSearchCriteriaTrait {
+ /**
+ * Search criteria instance
+ */
+ private $searchInstance = NULL;
+
+ /**
+ * Setter for search instance
+ *
+ * @param $searchInstance Searchable criteria instance
+ * @return void
+ */
+ public final function setSearchInstance (LocalSearchCriteria $searchInstance) {
+ $this->searchInstance = $searchInstance;
+ }
+
+ /**
+ * Getter for search instance
+ *
+ * @return $searchInstance Searchable criteria instance
+ */
+ public final function getSearchInstance () {
+ return $this->searchInstance;
+ }
+
+}
* @return void
* @todo This method is old code and needs heavy rewrite and should be moved to ApplicationHelper
*/
- public static final function exitApplication (string $message = '', int $code = -1, string $extraData = '', bool $silentMode = false) {
+ public static final function exitApplication (string $message = '', int $code = -1, string $extraData = '', bool $silentMode = false): void {
// Is this method already called?
//* NOISY-DEBUG: */ printf('[%s:%d]: message=%s,code=%d,extraData=%s,silentMode=%d - CALLED!' . PHP_EOL, __METHOD__, __LINE__, $message, $code, $extraData, intval($silentMode));
if (isset($GLOBALS['app_die_called'])) {
*
* @return $frameworkPath Path for framework
*/
- public static final function detectFrameworkPath () {
+ public static final function detectFrameworkPath (): string {
// Is it not set?
//* NOISY-DEBUG: */ printf('[%s:%d]: self::frameworkPath=%s - CALLED!' . PHP_EOL, __METHOD__, __LINE__, self::$frameworkPath);
if (empty(self::$frameworkPath)) {
*
* @return $rootPath Root path
*/
- public static function getRootPath () {
+ public static function getRootPath (): string {
// Get __DIR__, really simple and no detection
return __DIR__;
}
*
* @return void
*/
- public static final function main () {
+ public static final function main (): void {
// Load bootstrap file
//* NOISY-DEBUG: */ printf('[%s:%d]: CALLED!' . PHP_EOL, __METHOD__, __LINE__);
require sprintf('%sbootstrap%sbootstrap.inc.php', self::detectFrameworkPath(), DIRECTORY_SEPARATOR);