diff --git a/src/Database/PicoDataComparation.php b/src/Database/PicoDataComparation.php index cac15a9a..5e7a3980 100644 --- a/src/Database/PicoDataComparation.php +++ b/src/Database/PicoDataComparation.php @@ -62,7 +62,7 @@ class PicoDataComparation * Creates a comparison for equality. * * @param mixed $value The value to compare. - * @return self The PicoDataComparation object. + * @return self Returns the current instance for method chaining. */ public static function equals($value) { @@ -73,7 +73,7 @@ public static function equals($value) * Creates a comparison for inequality. * * @param mixed $value The value to compare. - * @return self The PicoDataComparation object. + * @return self Returns the current instance for method chaining. */ public static function notEquals($value) { @@ -84,7 +84,7 @@ public static function notEquals($value) * Creates a comparison for inclusion in a set. * * @param mixed[] $values The values to compare against. - * @return self The PicoDataComparation object. + * @return self Returns the current instance for method chaining. */ public static function in($values) { @@ -95,7 +95,7 @@ public static function in($values) * Creates a comparison for exclusion from a set. * * @param mixed[] $values The values to compare against. - * @return self The PicoDataComparation object. + * @return self Returns the current instance for method chaining. */ public static function notIn($values) { @@ -106,7 +106,7 @@ public static function notIn($values) * Creates a comparison using the LIKE operator. * * @param mixed $value The value to compare. - * @return self The PicoDataComparation object. + * @return self Returns the current instance for method chaining. */ public static function like($value) { @@ -117,7 +117,7 @@ public static function like($value) * Creates a comparison using the NOT LIKE operator. * * @param mixed $value The value to compare. - * @return self The PicoDataComparation object. + * @return self Returns the current instance for method chaining. */ public static function notLike($value) { @@ -128,7 +128,7 @@ public static function notLike($value) * Creates a comparison for less than. * * @param mixed $value The value to compare. - * @return self The PicoDataComparation object. + * @return self Returns the current instance for method chaining. */ public static function lessThan($value) { @@ -139,7 +139,7 @@ public static function lessThan($value) * Creates a comparison for greater than. * * @param mixed $value The value to compare. - * @return self The PicoDataComparation object. + * @return self Returns the current instance for method chaining. */ public static function greaterThan($value) { @@ -150,7 +150,7 @@ public static function greaterThan($value) * Creates a comparison for less than or equal to. * * @param mixed $value The value to compare. - * @return self The PicoDataComparation object. + * @return self Returns the current instance for method chaining. */ public static function lessThanOrEquals($value) { @@ -161,7 +161,7 @@ public static function lessThanOrEquals($value) * Creates a comparison for greater than or equal to. * * @param mixed $value The value to compare. - * @return self The PicoDataComparation object. + * @return self Returns the current instance for method chaining. */ public static function greaterThanOrEquals($value) { @@ -188,9 +188,12 @@ public function __construct($value, $comparison = self::EQUALS) } /** - * Gets the appropriate equals operator based on value. + * Returns the appropriate equals operator based on the value's state. * - * @return string + * If the value is null or of type null, returns the IS operator; + * otherwise, returns the standard equals operator. + * + * @return string The equals operator. */ private function _equals() { @@ -198,9 +201,12 @@ private function _equals() } /** - * Gets the appropriate not equals operator based on value. + * Returns the appropriate not equals operator based on the value's state. + * + * If the value is null or of type null, returns the IS NOT operator; + * otherwise, returns the standard not equals operator. * - * @return string + * @return string The not equals operator. */ private function _notEquals() { @@ -208,9 +214,9 @@ private function _notEquals() } /** - * Gets the less than operator. + * Returns the less than operator. * - * @return string + * @return string The less than operator. */ private function _lessThan() { @@ -218,9 +224,9 @@ private function _lessThan() } /** - * Gets the greater than operator. + * Returns the greater than operator. * - * @return string + * @return string The greater than operator. */ private function _greaterThan() { @@ -228,9 +234,9 @@ private function _greaterThan() } /** - * Gets the less than or equals operator. + * Returns the less than or equals operator. * - * @return string + * @return string The less than or equals operator. */ private function _lessThanOrEquals() { @@ -238,9 +244,9 @@ private function _lessThanOrEquals() } /** - * Gets the greater than or equals operator. + * Returns the greater than or equals operator. * - * @return string + * @return string The greater than or equals operator. */ private function _greaterThanOrEquals() { @@ -248,9 +254,9 @@ private function _greaterThanOrEquals() } /** - * Gets the comparison operator based on the value and type. + * Determines the comparison operator based on the current value and its type. * - * @return string + * @return string The comparison operator corresponding to the current state. */ public function getComparison() // NOSONAR { @@ -278,7 +284,7 @@ public function getComparison() // NOSONAR /** * Gets the value being compared. * - * @return mixed + * @return mixed The value that is currently being compared. */ public function getValue() { diff --git a/src/Database/PicoDatabase.php b/src/Database/PicoDatabase.php index 0feb76dc..47dd40bb 100644 --- a/src/Database/PicoDatabase.php +++ b/src/Database/PicoDatabase.php @@ -277,7 +277,7 @@ private function constructConnectionString($withDatabase = true) /** * Disconnect from the database. * - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function disconnect() { @@ -289,7 +289,7 @@ public function disconnect() * Set the time zone offset. * * @param string $timeZoneOffset Client time zone. - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function setTimeZoneOffset($timeZoneOffset) { @@ -302,7 +302,7 @@ public function setTimeZoneOffset($timeZoneOffset) * Change the database. * * @param string $databaseName Database name. - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function useDatabase($databaseName) { @@ -695,9 +695,12 @@ public function getDatabaseType() } /** - * Magic method to debug the object. + * Convert the object to a JSON string representation for debugging. * - * @return string Returns a JSON representation of the object's state. + * This method is intended for debugging purposes only and provides + * a JSON representation of the object's state. + * + * @return string The JSON representation of the object. */ public function __toString() { @@ -708,12 +711,22 @@ public function __toString() return json_encode($val); } + /** - * Set callback function when executing queries that modify data. + * Get callback function when executing queries that modify data. * - * @param callable|null $callbackExecuteQuery Callback function when executing queries that modify data. + * @return callable|null + */ + public function getCallbackExecuteQuery() + { + return $this->callbackExecuteQuery; + } + + /** + * Set callback function when executing queries that modify data. * - * @return self + * @param callable|null $callbackExecuteQuery Callback function when executing queries that modify data. + * @return self Returns the current instance for method chaining. */ public function setCallbackExecuteQuery($callbackExecuteQuery) { @@ -723,11 +736,20 @@ public function setCallbackExecuteQuery($callbackExecuteQuery) } /** - * Set callback function when executing any query. + * Get callback function when executing any query. * - * @param callable|null $callbackDebugQuery Callback function when executing any query. + * @return callable|null + */ + public function getCallbackDebugQuery() + { + return $this->callbackDebugQuery; + } + + /** + * Set callback function when executing any query. * - * @return self + * @param callable|null $callbackDebugQuery Callback function when executing any query. + * @return self Returns the current instance for method chaining. */ public function setCallbackDebugQuery($callbackDebugQuery) { diff --git a/src/Database/PicoDatabasePersistence.php b/src/Database/PicoDatabasePersistence.php index a6380685..6e2805f5 100644 --- a/src/Database/PicoDatabasePersistence.php +++ b/src/Database/PicoDatabasePersistence.php @@ -2811,9 +2811,7 @@ public function deleteBy($propertyName, $propertyValue) * @param string $propertyName The name of the property to filter the records by. * @param mixed $propertyValue The value of the property to match against. * @param PicoSortable|string|null $sortable Optional. Defines sorting for the result set. - * * @return array|null Returns the matching record as an associative array, or null if no record is found. - * * @throws EntityException If there is an issue with the entity operations. * @throws InvalidFilterException If the constructed filter is invalid. * @throws EmptyResultException If the query results in an empty set. @@ -2944,7 +2942,6 @@ private function getRealClassNameWithoutPackage($classNameJoin) * If the key exists, it returns that value; otherwise, it returns the standard column name. * * @param array $join The join column definition, which may include keys for reference and standard column names. - * * @return string The reference column name, either from the specific key or the standard name. */ private function getReferenceColumnName($join) @@ -2968,7 +2965,6 @@ private function getReferenceColumnName($join) * @param string $classNameJoin The name of the class to join with. * @param string $referenceColumName The name of the reference column to look up. * @param PicoTableInfo $info The table information containing metadata about the columns. - * * @return string|null The corresponding property name if found, otherwise the reference column name. */ private function getJoinKeyName($classNameJoin, $referenceColumName, $info) @@ -2994,8 +2990,7 @@ private function getJoinKeyName($classNameJoin, $referenceColumName, $info) * for storing results from subsequent queries. * * @param string $classNameJoin The class name for which to prepare the join cache. - * - * @return self Returns the current instance to allow method chaining. + * @return self Returns the current instance for method chaining. */ private function prepareJoinCache($classNameJoin) { @@ -3076,7 +3071,6 @@ private function getJoinData($classNameJoin, $referenceColumName, $joinKeyValue, * @param mixed $data The original object or array to be populated with joined data. * @param array $row The row of data containing column values. * @param PicoTableInfo $info The table information that includes join column metadata. - * * @return mixed The updated object or array with joined data. */ public function join($data, $row, $info) @@ -3120,7 +3114,6 @@ public function join($data, $row, $info) * @param array|object $data The original data (array or object). * @param string $propName The name of the property to add. * @param mixed $value The value to assign to the property. - * * @return array|object The updated data array or object with the new property. */ private function addProperty($data, $propName, $value) @@ -3142,7 +3135,6 @@ private function addProperty($data, $propName, $value) * This method checks if the provided filter is not null, not empty, and not a whitespace string. * * @param string $filter The filter string to validate. - * * @return bool True if the filter is valid; otherwise, false. */ private function isValidFilter($filter) @@ -3157,7 +3149,6 @@ private function isValidFilter($filter) * a valid, non-empty string. * * @param string $value The value to check. - * * @return bool True if the value is valid; otherwise, false. */ private function notNullAndNotEmptyAndNotSpace($value) @@ -3174,7 +3165,6 @@ private function notNullAndNotEmptyAndNotSpace($value) * * @param array $data The input data to be fixed. * @param PicoTableInfo $info The table information containing type definitions. - * * @return array The data with fixed types. */ public function fixDataType($data, $info) @@ -3201,7 +3191,6 @@ public function fixDataType($data, $info) * * @param mixed $value The input value to be fixed. * @param string $type The expected data type of the value. - * * @return mixed The value converted to the specified type. */ public function fixData($value, $type) @@ -3266,7 +3255,6 @@ public function fixData($value, $type) * if it should return `true`; otherwise, it returns `false`. * * @param mixed $value The input value to convert. - * * @return bool True if the value is equivalent to `1`; otherwise, false. */ private function boolval($value) @@ -3281,7 +3269,6 @@ private function boolval($value) * returns null instead. * * @param mixed $value The input value to convert. - * * @return mixed The integer value or null if the input is null. */ private function intval($value) @@ -3304,7 +3291,6 @@ private function intval($value) * returns null instead. * * @param mixed $value The input value to convert. - * * @return mixed The double value or null if the input is null. */ private function doubleval($value) @@ -3328,7 +3314,6 @@ private function doubleval($value) * * @param mixed $value The input value to fix. * @param array $column The column information containing potential date format. - * * @return mixed The formatted date string or the original value. */ private function fixInput($value, $column) @@ -3353,7 +3338,6 @@ private function fixInput($value, $column) * This method checks specific string representations of null or default datetime values. * * @param string $value The value to check. - * * @return bool True if the value represents a null datetime; otherwise, false. */ private function isDateTimeNull($value) @@ -3460,7 +3444,6 @@ public function selectQuery() * @param mixed|null $specification Optional specifications for the query. * @param mixed|null $pageable Optional pagination settings for the query. * @param mixed|null $sortable Optional sorting settings for the query. - * * @return mixed The matching record or null if not found. * @throws EntityException If an error occurs during the selection process. * @throws InvalidFilterException If the provided filter is invalid. @@ -3537,7 +3520,6 @@ private function _select($info = null, $queryBuilder = null, $where = null, $spe * @param mixed|null $specification Optional specifications for the query. * @param mixed|null $pageable Optional pagination settings for the query. * @param mixed|null $sortable Optional sorting settings for the query. - * * @return array An array of matching records. * @throws EntityException If an error occurs during the selection process. * @throws InvalidFilterException If the provided filter is invalid. @@ -3606,7 +3588,6 @@ private function _selectAll($info = null, $queryBuilder = null, $where = null, $ * @param PicoTableInfo|null $info The table information. If null, fetched internally. * @param PicoDatabaseQueryBuilder|null $queryBuilder The query builder. If null, created internally. * @param string|null $where The where clause for the query. If null, fetched internally. - * * @return PicoDatabaseQueryBuilder The query builder with the select query prepared. * @throws InvalidFilterException If the provided filter is invalid. * @throws EntityException If an error occurs while preparing the query. @@ -3644,7 +3625,6 @@ private function _selectQuery($info = null, $queryBuilder = null, $where = null) * specified table. It accepts an optional flag to include null values in the update. * * @param bool $includeNull Optional. If true, null values are included in the update. - * * @return PDOStatement The executed update statement. * @throws EntityException If an error occurs during the update process. */ @@ -3664,7 +3644,6 @@ public function update($includeNull = false) * returns the query builder for further modifications. * * @param bool $includeNull Optional. If true, null values are included in the update. - * * @return PicoDatabaseQueryBuilder The query builder with the update query prepared. * @throws EntityException If an error occurs while preparing the query. */ @@ -3686,7 +3665,6 @@ public function updateQuery($includeNull = false) * @param PicoTableInfo|null $info The table information. If null, fetched internally. * @param PicoDatabaseQueryBuilder|null $queryBuilder The query builder. If null, created internally. * @param string|null $where The where clause for the query. If null, fetched internally. - * * @return PDOStatement The executed update statement. * @throws InvalidFilterException If the provided filter is invalid. */ @@ -3705,7 +3683,6 @@ private function _update($info = null, $queryBuilder = null, $where = null) * @param PicoTableInfo|null $info The table information. If null, fetched internally. * @param PicoDatabaseQueryBuilder|null $queryBuilder The query builder. If null, created internally. * @param string|null $where The where clause for the query. If null, fetched internally. - * * @return PicoDatabaseQueryBuilder The query builder with the update query prepared. * @throws InvalidFilterException If the provided filter is invalid. * @throws EntityException If an error occurs while preparing the query. @@ -3780,7 +3757,6 @@ public function deleteQuery() * @param PicoTableInfo|null $info The table information. If null, fetched internally. * @param PicoDatabaseQueryBuilder|null $queryBuilder The query builder. If null, created internally. * @param string|null $where The where clause for the query. If null, fetched internally. - * * @return PDOStatement The executed delete statement. */ private function _delete($info = null, $queryBuilder = null, $where = null) @@ -3798,7 +3774,6 @@ private function _delete($info = null, $queryBuilder = null, $where = null) * @param PicoTableInfo|null $info The table information. If null, fetched internally. * @param PicoDatabaseQueryBuilder|null $queryBuilder The query builder. If null, created internally. * @param string|null $where The where clause for the query. If null, fetched internally. - * * @return PicoDatabaseQueryBuilder The query builder with the delete query prepared. * @throws InvalidFilterException If the provided filter is invalid. * @throws EntityException If an error occurs while preparing the query. @@ -3836,7 +3811,6 @@ private function _deleteQuery($info = null, $queryBuilder = null, $where = null) * and configures it with a WHERE clause derived from the provided specification. * * @param PicoSpecification $specification The specification used to define the WHERE clause. - * * @return PicoDatabasePersistenceExtended The configured persistence object with the WHERE clause. */ public function whereWithSpecification($specification) @@ -3868,7 +3842,6 @@ public function whereWithSpecification($specification) * This method verifies whether the provided value is set and is an array. * * @param mixed $value The value to be checked. - * * @return bool True if the value is an array, false otherwise. */ public static function isArray($value) @@ -3877,10 +3850,13 @@ public static function isArray($value) } /** - * Undocumented function + * Check if the given input is not empty. + * + * This function determines if the provided input is set and not empty, + * returning true if it contains a non-empty value, and false otherwise. * - * @param string $input - * @return boolean + * @param mixed $input The input value to check. + * @return bool True if the input is not empty, false otherwise. */ public static function isNotEmpty($input) { diff --git a/src/Database/PicoDatabaseStructure.php b/src/Database/PicoDatabaseStructure.php index c4284067..47a7c1b4 100644 --- a/src/Database/PicoDatabaseStructure.php +++ b/src/Database/PicoDatabaseStructure.php @@ -143,7 +143,6 @@ public function getObjectInfo() $reflexClass = new PicoAnnotationParser($this->className); $table = $reflexClass->getParameter(self::ANNOTATION_TABLE); $values = $this->parseKeyValue($reflexClass, $table, self::ANNOTATION_TABLE); - $picoTableName = $values[self::KEY_NAME]; $columns = array(); $primaryKeys = array(); diff --git a/src/Database/PicoDatabaseType.php b/src/Database/PicoDatabaseType.php index a4a36b2a..06bbb79a 100644 --- a/src/Database/PicoDatabaseType.php +++ b/src/Database/PicoDatabaseType.php @@ -5,14 +5,18 @@ /** * Class PicoDatabaseType * - * This class defines constants representing various database types - * supported by the MagicObject framework. It provides a centralized - * way to reference these types, improving code clarity and maintainability. - * - * Supported database types include MySQL, MariaDB, PostgreSQL, and SQLite. - * - * @author Kamshory + * Defines constants for various database types supported by the MagicObject framework. + * This class provides a centralized reference to these types, enhancing code clarity + * and maintainability. + * + * Supported database types include: + * - MySQL + * - MariaDB + * - PostgreSQL + * - SQLite + * * @package MagicObject\Database + * @author Kamshory * @link https://github.com/Planetbiru/MagicObject */ class PicoDatabaseType diff --git a/src/Database/PicoJoinMap.php b/src/Database/PicoJoinMap.php index fafc7230..236d4686 100644 --- a/src/Database/PicoJoinMap.php +++ b/src/Database/PicoJoinMap.php @@ -117,9 +117,12 @@ public function getJoinTableAlias() } /** - * Magic method to return a JSON representation of the object. + * Convert the object to a JSON string representation for debugging. * - * @return string JSON representation of the join map. + * This method is intended for debugging purposes only and provides + * a JSON representation of the object's state. + * + * @return string The JSON representation of the object. */ public function __toString() { diff --git a/src/Database/PicoLimit.php b/src/Database/PicoLimit.php index c85670a4..cd233c2f 100644 --- a/src/Database/PicoLimit.php +++ b/src/Database/PicoLimit.php @@ -46,7 +46,7 @@ public function __construct($offset = 0, $limit = 0) * This method adjusts the offset based on the current limit, allowing * for the retrieval of the next set of records in a paginated result. * - * @return self + * @return self Returns the current instance for method chaining. */ public function nextPage() { @@ -60,7 +60,7 @@ public function nextPage() * This method adjusts the offset back, ensuring it does not fall below * zero, thus allowing navigation to the previous set of records. * - * @return self + * @return self Returns the current instance for method chaining. */ public function previousPage() { @@ -84,7 +84,7 @@ public function getLimit() * This method ensures that the limit is at least 1. * * @param int $limit The maximum number of records. - * @return self + * @return self Returns the current instance for method chaining. */ public function setLimit($limit) { @@ -108,7 +108,7 @@ public function getOffset() * This method ensures that the offset is not negative. * * @param int $offset The number of records to skip. - * @return self + * @return self Returns the current instance for method chaining. */ public function setOffset($offset) { @@ -133,12 +133,12 @@ public function getPage() } /** - * Return a string representation of the object in JSON format. + * Convert the object to a JSON string representation for debugging. * - * This method provides a convenient way to view the current limit - * and offset settings as a JSON string. + * This method is intended for debugging purposes only and provides + * a JSON representation of the object's state. * - * @return string + * @return string The JSON representation of the object. */ public function __toString() { diff --git a/src/Database/PicoPage.php b/src/Database/PicoPage.php index 0bd2ebbf..2dddb249 100644 --- a/src/Database/PicoPage.php +++ b/src/Database/PicoPage.php @@ -31,8 +31,10 @@ class PicoPage /** * Constructor. * - * @param int $pageNumber Page number. - * @param int $pageSize Page size. + * Initializes the page number and page size. + * + * @param int $pageNumber Page number (default is 1). + * @param int $pageSize Page size (default is 1). */ public function __construct($pageNumber = 1, $pageSize = 1) { @@ -65,9 +67,9 @@ public function previousPage() } /** - * Get the current page number. + * Retrieves the current page number. * - * @return int + * @return int The current page number. */ public function getPageNumber() { @@ -87,9 +89,9 @@ public function setPageNumber($pageNumber) } /** - * Get the page size (number of items per page). + * Retrieves the page size (number of items per page). * - * @return int + * @return int The page size. */ public function getPageSize() { @@ -109,9 +111,9 @@ public function setPageSize($pageSize) } /** - * Get the limit and offset for database queries. + * Calculates the limit and offset for database queries. * - * @return PicoLimit + * @return PicoLimit An instance of PicoLimit with the calculated offset and limit. */ public function getLimit() { @@ -122,9 +124,12 @@ public function getLimit() } /** - * Magic method to return a string representation of the object. + * Convert the object to a JSON string representation for debugging. + * + * This method is intended for debugging purposes only and provides + * a JSON representation of the object's state. * - * @return string + * @return string The JSON representation of the object. */ public function __toString() { diff --git a/src/Database/PicoPageControl.php b/src/Database/PicoPageControl.php index 675b07c6..7cf542e5 100644 --- a/src/Database/PicoPageControl.php +++ b/src/Database/PicoPageControl.php @@ -19,60 +19,62 @@ class PicoPageControl { /** - * Page data + * Page data object containing pagination information. * * @var PicoPageData */ private $pageData; /** - * Parameter name + * Parameter name used for pagination in the URL. * * @var string */ private $parameterName; /** - * Path + * Base path for pagination links. * * @var string */ private $path; /** - * Prev + * Symbol for the previous page button. * * @var string */ private $prev; /** - * Next + * Symbol for the next page button. * * @var string */ private $next; /** - * First + * Symbol for the first page button. * * @var string */ private $first; /** - * Last + * Symbol for the last page button. * * @var string */ private $last; /** - * Constructor + * Constructor for the PicoPageControl class. * - * @param PicoPageData $pageData Page data - * @param string $parameterName Parameter name for page - * @param string $path Full path + * Initializes pagination control with page data and optional parameter name and path. + * + * @param PicoPageData $pageData Page data object for pagination. + * @param string $parameterName Parameter name for the page (default is 'page'). + * @param string|null $path Full path for generating pagination links (optional). */ public function __construct($pageData, $parameterName = 'page', $path = null) { @@ -88,9 +90,11 @@ public function __construct($pageData, $parameterName = 'page', $path = null) } /** - * Set margin to pagination + * Sets the margin for pagination controls. + * + * This defines how many pages to show before and after the current page. * - * @param int $margin Margin (previous and next) from current page + * @param int $margin Margin (number of pages before and after the current page). * @return self Returns the current instance for method chaining. */ public function setMargin($margin) @@ -100,12 +104,12 @@ public function setMargin($margin) } /** - * Set navigation + * Sets custom navigation symbols for pagination buttons. * - * @param string $prev Button symbol for previous page - * @param string $next Button symbol for next page - * @param string $first Button symbol for first page - * @param string $last Button symbol for last page + * @param string|null $prev Button symbol for the previous page (optional). + * @param string|null $next Button symbol for the next page (optional). + * @param string|null $first Button symbol for the first page (optional). + * @param string|null $last Button symbol for the last page (optional). * @return self Returns the current instance for method chaining. */ public function setNavigation($prev = null, $next = null, $first = null, $last = null) @@ -118,9 +122,9 @@ public function setNavigation($prev = null, $next = null, $first = null, $last = } /** - * To HTML + * Converts the pagination control to HTML format. * - * @return string + * @return string HTML representation of the pagination controls. */ public function toHTML() { @@ -128,9 +132,9 @@ public function toHTML() } /** - * Create HTML + * Generates the HTML for pagination controls. * - * @return string + * @return string HTML representation of the pagination controls. */ public function __toString() { diff --git a/src/Database/PicoPageData.php b/src/Database/PicoPageData.php index c7fd1a8c..99202e99 100644 --- a/src/Database/PicoPageData.php +++ b/src/Database/PicoPageData.php @@ -311,9 +311,12 @@ public function getPageSize() } /** - * Magic method to represent the object as a JSON string. + * Convert the object to a JSON string representation for debugging. * - * @return string JSON representation of the object. + * This method is intended for debugging purposes only and provides + * a JSON representation of the object's state. + * + * @return string The JSON representation of the object. */ public function __toString() { diff --git a/src/Database/PicoPageable.php b/src/Database/PicoPageable.php index 807b55d2..6103fec2 100644 --- a/src/Database/PicoPageable.php +++ b/src/Database/PicoPageable.php @@ -15,23 +15,23 @@ class PicoPageable { /** - * Page + * Current page information. * - * @var PicoPage + * @var PicoPage|null */ private $page = null; /** - * Sortable + * Sortable information. * - * @var PicoSortable + * @var PicoSortable|null */ private $sortable = null; /** - * Offset and limit + * Offset and limit for database queries. * - * @var PicoLimit + * @var PicoLimit|null */ private $offsetLimit = null; @@ -80,9 +80,9 @@ public function __construct($page = null, $sortable = null) /** - * Get sortable + * Retrieves the sortable information. * - * @return PicoSortable + * @return PicoSortable|null */ public function getSortable() { @@ -90,9 +90,9 @@ public function getSortable() } /** - * Set sortable + * Sets the sortable information. * - * @param PicoSortable $sortable Sortable + * @param PicoSortable $sortable Sortable information. * * @return self Returns the current instance for method chaining. */ @@ -104,11 +104,13 @@ public function setSortable($sortable) } /** - * Add sortable + * Adds a sortable criterion. + * + * @param string $sortBy The field to sort by. + * @param string $sortType The type of sorting (e.g., 'asc' or 'desc'). * - * @param string $sortBy Sort by - * @param string $sortType Sort type * @return self Returns the current instance for method chaining. + * @throws InvalidParameterException If $sortBy is null or empty. */ public function addSortable($sortBy, $sortType) { @@ -124,10 +126,10 @@ public function addSortable($sortBy, $sortType) } /** - * Create sort by + * Creates the ORDER BY clause based on the current sortable criteria. * - * @param PicoTableInfo $tableInfo Table information - * @return string|null + * @param PicoTableInfo $tableInfo Information about the table. + * @return string|null The ORDER BY clause or null if no sortable criteria exist. */ public function createOrderBy($tableInfo) { @@ -139,9 +141,9 @@ public function createOrderBy($tableInfo) } /** - * Get page + * Retrieves the current page information. * - * @return PicoPage + * @return PicoPage|null */ public function getPage() { @@ -149,9 +151,9 @@ public function getPage() } /** - * Set page + * Sets the current page information. * - * @param PicoPage $page Page + * @param PicoPage $page Page information. * * @return self Returns the current instance for method chaining. */ @@ -165,9 +167,9 @@ public function setPage($page) } /** - * Get offset and limit + * Retrieves the offset and limit for database queries. * - * @return PicoLimit + * @return PicoLimit|null */ public function getOffsetLimit() { @@ -175,9 +177,9 @@ public function getOffsetLimit() } /** - * Set offset and limit + * Sets the offset and limit for database queries. * - * @param PicoLimit $offsetLimit Offset and limit + * @param PicoLimit $offsetLimit Offset and limit information. * * @return self Returns the current instance for method chaining. */ @@ -189,9 +191,12 @@ public function setOffsetLimit($offsetLimit) } /** - * Magic method to debug object + * Convert the object to a JSON string representation for debugging. + * + * This method is intended for debugging purposes only and provides + * a JSON representation of the object's state. * - * @return string + * @return string The JSON representation of the object. */ public function __toString() { diff --git a/src/Database/PicoPredicate.php b/src/Database/PicoPredicate.php index 147a1ed7..3d55458a 100644 --- a/src/Database/PicoPredicate.php +++ b/src/Database/PicoPredicate.php @@ -396,7 +396,10 @@ public static function functionAndValue($function, $value) } /** - * Convert the object to a JSON string representation. + * Convert the object to a JSON string representation for debugging. + * + * This method is intended for debugging purposes only and provides + * a JSON representation of the object's state. * * @return string The JSON representation of the object. */ diff --git a/src/Database/PicoSortable.php b/src/Database/PicoSortable.php index 5adfec0f..9abfad6b 100644 --- a/src/Database/PicoSortable.php +++ b/src/Database/PicoSortable.php @@ -223,9 +223,12 @@ public static function getInstance() } /** - * Convert the object to a string representation for debugging purposes. + * Convert the object to a JSON string representation for debugging. * - * @return string The string representation of the sortable criteria. + * This method is intended for debugging purposes only and provides + * a JSON representation of the object's state. + * + * @return string The JSON representation of the object. */ public function __toString() { diff --git a/src/Database/PicoSpecification.php b/src/Database/PicoSpecification.php index d8710e54..46541bea 100644 --- a/src/Database/PicoSpecification.php +++ b/src/Database/PicoSpecification.php @@ -374,9 +374,12 @@ private function addPredicate($field, $value) } /** - * Magic method for debugging the object. + * Convert the object to a JSON string representation for debugging. * - * @return string A string representation of the current specifications. + * This method is intended for debugging purposes only and provides + * a JSON representation of the object's state. + * + * @return string The JSON representation of the object. */ public function __toString() { diff --git a/src/Database/PicoSpecificationFilter.php b/src/Database/PicoSpecificationFilter.php index e1789e00..002034f0 100644 --- a/src/Database/PicoSpecificationFilter.php +++ b/src/Database/PicoSpecificationFilter.php @@ -51,9 +51,12 @@ public function __construct($columnName, $dataType) } /** - * Magic method to return a JSON representation of the object. + * Convert the object to a JSON string representation for debugging. * - * @return string JSON encoded string of the object properties. + * This method is intended for debugging purposes only and provides + * a JSON representation of the object's state. + * + * @return string The JSON representation of the object. */ public function __toString() { diff --git a/src/Database/PicoTableInfo.php b/src/Database/PicoTableInfo.php index ed605497..62e4f0bb 100644 --- a/src/Database/PicoTableInfo.php +++ b/src/Database/PicoTableInfo.php @@ -141,6 +141,8 @@ public function __toString() $stdClass->autoIncrementKeys = $this->autoIncrementKeys; $stdClass->defaultValue = $this->defaultValue; $stdClass->notNullColumns = $this->notNullColumns; + $stdClass->this->noCache = $this->noCache; + $stdClass->package = $this->package; return json_encode($stdClass); } @@ -359,8 +361,6 @@ public function setNoCache($noCache) return $this; } - - /** * Get the package name or namespace. * diff --git a/src/Geometry/Area.php b/src/Geometry/Area.php index db0f990c..a0ffff4e 100644 --- a/src/Geometry/Area.php +++ b/src/Geometry/Area.php @@ -208,7 +208,7 @@ public function getZoom() * Set the zoom factor. * * @param float $zoom Zoom factor - * @return self + * @return self Returns the current instance for method chaining. */ public function setZoom($zoom) { diff --git a/src/Geometry/Map.php b/src/Geometry/Map.php index f74fef90..9aade135 100644 --- a/src/Geometry/Map.php +++ b/src/Geometry/Map.php @@ -39,7 +39,7 @@ public function __construct($areas = null) * This method appends a new Area object to the map's collection of areas. * * @param Area $area Area to add - * @return self + * @return self Returns the current instance for method chaining. */ public function addArea($area) { diff --git a/src/Geometry/Polygon.php b/src/Geometry/Polygon.php index dc12ea26..061a0cfa 100644 --- a/src/Geometry/Polygon.php +++ b/src/Geometry/Polygon.php @@ -37,7 +37,7 @@ public function __construct($points = []) * Add a point to the polygon. * * @param Point $point Point to add. - * @return self + * @return self Returns the current instance for method chaining. */ public function addPoint($point) { @@ -50,7 +50,7 @@ public function addPoint($point) * * This method removes all points currently defined for the polygon. * - * @return self + * @return self Returns the current instance for method chaining. */ public function clearPolygon() { diff --git a/src/Getter.php b/src/Getter.php index 880e9149..8ad24824 100644 --- a/src/Getter.php +++ b/src/Getter.php @@ -83,7 +83,7 @@ public function loadData($data) public function get($propertyName) { $var = PicoStringUtil::camelize($propertyName); - return isset($this->$var) ? $this->$var : null; + return isset($this->{$var}) ? $this->{$var} : null; } /** @@ -99,7 +99,7 @@ public function value($snakeCase = false) foreach ($this as $key => $val) { if(!in_array($key, $parentProps)) { - $value->$key = $val; + $value->{$key} = $val; } } if($snakeCase) @@ -107,7 +107,7 @@ public function value($snakeCase = false) $value2 = new stdClass; foreach ($value as $key => $val) { $key2 = PicoStringUtil::snakeize($key); - $value2->$key2 = $val; + $value2->{$key2} = $val; } return $value2; } @@ -160,11 +160,11 @@ public function __call($method, $params) // NOSONAR { if (strncasecmp($method, "get", 3) === 0) { $var = lcfirst(substr($method, 3)); - return isset($this->$var) ? $this->$var : null; + return isset($this->{$var}) ? $this->{$var} : null; } else if (strncasecmp($method, "equals", 6) === 0) { $var = lcfirst(substr($method, 6)); - $value = isset($this->$var) ? $this->$var : null; + $value = isset($this->{$var}) ? $this->{$var} : null; return isset($params[0]) && $params[0] == $value; } } diff --git a/src/Language/PicoEntityLanguage.php b/src/Language/PicoEntityLanguage.php index 7b1f63a1..23686cfe 100644 --- a/src/Language/PicoEntityLanguage.php +++ b/src/Language/PicoEntityLanguage.php @@ -84,7 +84,7 @@ public function __construct($entity = null) * Load data into the object from the given entity. * * @param MagicObject $entity The entity to load. - * @return self + * @return self Returns the current instance for method chaining. */ public function loadEntityLabel($entity) { @@ -129,7 +129,7 @@ public function loadEntityLabel($entity) * @param string $code Language code. * @param object|stdClass|array $reference Reference data for the language. * @param bool $use Flag to indicate whether to use this language immediately. - * @return self + * @return self Returns the current instance for method chaining. */ public function addLanguage($code, $reference, $use = false) { @@ -144,7 +144,7 @@ public function addLanguage($code, $reference, $use = false) * Remove a language from the entity. * * @param string $code Language code to remove. - * @return self + * @return self Returns the current instance for method chaining. */ public function removeLanguage($code) { @@ -162,7 +162,7 @@ public function removeLanguage($code) * Set the current language. * * @param string $code Language code to set as current. - * @return self + * @return self Returns the current instance for method chaining. */ public function selectLanguage($code) { @@ -236,12 +236,12 @@ private function label($reflexProp, $parameters, $defaultLabel) * * @param string $propertyName Name of the property to set. * @param mixed|null $propertyValue Value to set for the property. - * @return self + * @return self Returns the current instance for method chaining. */ public function set($propertyName, $propertyValue) { $var = PicoStringUtil::camelize($propertyName); - $this->$var = $propertyValue; + $this->{$var} = $propertyValue; return $this; } @@ -284,7 +284,7 @@ public function __get($name) */ public function __isset($name) { - return isset($this->$name); + return isset($this->{$name}); } /** diff --git a/src/Language/PicoLanguage.php b/src/Language/PicoLanguage.php index 2a6690be..765b5d0e 100644 --- a/src/Language/PicoLanguage.php +++ b/src/Language/PicoLanguage.php @@ -33,7 +33,7 @@ public function __construct($data = null) * Load data into the object. * * @param stdClass|array $data Data to be loaded into the object. - * @return self + * @return self Returns the current instance for method chaining. */ public function loadData($data) { @@ -51,12 +51,12 @@ public function loadData($data) * * @param string $propertyName Name of the property to set. * @param mixed|null $propertyValue Value to assign to the property. - * @return self + * @return self Returns the current instance for method chaining. */ public function set($propertyName, $propertyValue) { $var = PicoStringUtil::camelize($propertyName); - $this->$var = $propertyValue; + $this->{$var} = $propertyValue; return $this; } @@ -69,7 +69,7 @@ public function set($propertyName, $propertyValue) public function get($propertyName) { $var = PicoStringUtil::camelize($propertyName); - return isset($this->$var) ? $this->$var : null; + return isset($this->{$var}) ? $this->{$var} : null; } /** @@ -107,7 +107,7 @@ public function __get($name) */ public function __isset($name) { - return isset($this->$name); + return isset($this->{$name}); } /** @@ -118,7 +118,7 @@ public function __isset($name) */ public function __unset($name) { - unset($this->$name); + unset($this->{$name}); } /** @@ -150,7 +150,7 @@ public function __call($method, $params) // NOSONAR return $this->get($var); } elseif (strncasecmp($method, "equals", 6) === 0) { $var = lcfirst(substr($method, 6)); - $value = isset($this->$var) ? $this->$var : null; + $value = isset($this->{$var}) ? $this->{$var} : null; return isset($params[0]) && $params[0] == $value; } } diff --git a/src/MagicDto.php b/src/MagicDto.php index 89ceb7be..b8109860 100644 --- a/src/MagicDto.php +++ b/src/MagicDto.php @@ -74,7 +74,6 @@ public function __construct($data = null) throw new InvalidAnnotationException("Invalid annotation @".$paramName); } } - } /** @@ -194,15 +193,15 @@ public function value() $objectTest = $this->createTestObject($var); if ($this->isSelfInstance($objectTest)) { - $returnValue->$propertyName = $this->handleSelfInstance($source, $var, $propertyName); + $returnValue->{$propertyName} = $this->handleSelfInstance($source, $var, $propertyName); } elseif ($this->isMagicObjectInstance($objectTest)) { - $returnValue->$propertyName = $this->handleMagicObject($source, $propertyName); + $returnValue->{$propertyName} = $this->handleMagicObject($source, $propertyName); } elseif ($this->isDateTimeInstance($objectTest)) { - $returnValue->$propertyName = $this->formatDateTime($this->handleDateTimeObject($source, $propertyName), $this, $key); + $returnValue->{$propertyName} = $this->formatDateTime($this->handleDateTimeObject($source, $propertyName), $this, $key); } else if($this->_dataSource instanceof stdClass || is_object($this->_dataSource)) { - $returnValue->$propertyName = $this->handleStdClass($source, $key); + $returnValue->{$propertyName} = $this->handleStdClass($source, $key); } else if(isset($this->_dataSource)) { - $returnValue->$propertyName = $this->handleDefaultCase($source, $key); + $returnValue->{$propertyName} = $this->handleDefaultCase($source, $key); } } } diff --git a/src/MagicObject.php b/src/MagicObject.php index 7366f402..036f219b 100644 --- a/src/MagicObject.php +++ b/src/MagicObject.php @@ -212,7 +212,7 @@ public function loadData($data) * * @param string $rawData Raw INI data * @param bool $systemEnv Flag to indicate whether to use environment variables - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function loadIniString($rawData, $systemEnv = false) { @@ -236,7 +236,7 @@ public function loadIniString($rawData, $systemEnv = false) * * @param string $path File path to the INI file * @param bool $systemEnv Flag to indicate whether to use environment variables - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function loadIniFile($path, $systemEnv = false) { @@ -262,7 +262,7 @@ public function loadIniFile($path, $systemEnv = false) * @param bool $systemEnv Replace all environment variable values * @param bool $asObject Result as an object instead of an array * @param bool $recursive Convert all objects to MagicObject - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function loadYamlString($rawData, $systemEnv = false, $asObject = false, $recursive = false) { @@ -310,7 +310,7 @@ public function loadYamlString($rawData, $systemEnv = false, $asObject = false, * @param bool $systemEnv Replace all environment variable values * @param bool $asObject Result as an object instead of an array * @param bool $recursive Convert all objects to MagicObject - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function loadYamlFile($path, $systemEnv = false, $asObject = false, $recursive = false) { @@ -358,7 +358,7 @@ public function loadYamlFile($path, $systemEnv = false, $asObject = false, $recu * @param bool $systemEnv Replace all environment variable values * @param bool $asObject Result as an object instead of an array * @param bool $recursive Convert all objects to MagicObject - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function loadJsonString($rawData, $systemEnv = false, $asObject = false, $recursive = false) { @@ -406,7 +406,7 @@ public function loadJsonString($rawData, $systemEnv = false, $asObject = false, * @param bool $systemEnv Replace all environment variable values * @param bool $asObject Result as an object instead of an array * @param bool $recursive Convert all objects to MagicObject - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function loadJsonFile($path, $systemEnv = false, $asObject = false, $recursive = false) { @@ -454,7 +454,7 @@ public function loadJsonFile($path, $systemEnv = false, $asObject = false, $recu * but loadData will still function normally. * * @param bool $readonly Flag to set the object as read-only - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ protected function readOnly($readonly) { @@ -466,7 +466,7 @@ protected function readOnly($readonly) * Set the database connection. * * @param PicoDatabase $database Database connection - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function withDatabase($database) { @@ -543,7 +543,7 @@ public function removePropertyExcept($sourceData, $propertyNames) { if(in_array($key, $propertyNames)) { - $resultData->$key = $val; + $resultData->{$key} = $val; } } return $resultData; @@ -607,7 +607,7 @@ public function saveQuery($includeNull = false) /** * Select data from the database. * - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. * @throws NoDatabaseConnectionException|NoRecordFoundException|PDOException */ public function select() @@ -632,7 +632,7 @@ public function select() /** * Select all data from the database. * - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. * @throws NoDatabaseConnectionException|NoRecordFoundException|PDOException */ public function selectAll() @@ -1082,7 +1082,7 @@ private function modifyNullProperties($propertyName, $propertyValue) * @param string $propertyName Property name * @param mixed|null $propertyValue Property value * @param bool $skipModifyNullProperties Skip modifying null properties - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function set($propertyName, $propertyValue, $skipModifyNullProperties = false) { @@ -1100,16 +1100,16 @@ public function set($propertyName, $propertyValue, $skipModifyNullProperties = f * * @param string $propertyName Property name * @param mixed $propertyValue Property value - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function push($propertyName, $propertyValue) { $var = PicoStringUtil::camelize($propertyName); - if(!isset($this->$var)) + if(!isset($this->{$var})) { - $this->$var = array(); + $this->{$var} = array(); } - array_push($this->$var, $propertyValue); + array_push($this->{$var}, $propertyValue); return $this; } @@ -1118,7 +1118,7 @@ public function push($propertyName, $propertyValue) * * @param string $propertyName Property name * @param mixed $propertyValue Property value - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function append($propertyName, $propertyValue) { @@ -1130,16 +1130,16 @@ public function append($propertyName, $propertyValue) * * @param string $propertyName Property name * @param mixed $propertyValue Property value - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function unshift($propertyName, $propertyValue) { $var = PicoStringUtil::camelize($propertyName); - if(!isset($this->$var)) + if(!isset($this->{$var})) { - $this->$var = array(); + $this->{$var} = array(); } - array_unshift($this->$var, $propertyValue); + array_unshift($this->{$var}, $propertyValue); return $this; } @@ -1148,7 +1148,7 @@ public function unshift($propertyName, $propertyValue) * * @param string $propertyName Property name * @param mixed $propertyValue Property value - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ public function prepend($propertyName, $propertyValue) { @@ -1164,9 +1164,9 @@ public function prepend($propertyName, $propertyValue) public function pop($propertyName) { $var = PicoStringUtil::camelize($propertyName); - if(isset($this->$var) && is_array($this->$var)) + if(isset($this->{$var}) && is_array($this->{$var})) { - return array_pop($this->$var); + return array_pop($this->{$var}); } return null; } @@ -1180,9 +1180,9 @@ public function pop($propertyName) public function shift($propertyName) { $var = PicoStringUtil::camelize($propertyName); - if(isset($this->$var) && is_array($this->$var)) + if(isset($this->{$var}) && is_array($this->{$var})) { - return array_shift($this->$var); + return array_shift($this->{$var}); } return null; } @@ -1196,7 +1196,7 @@ public function shift($propertyName) public function get($propertyName) { $var = PicoStringUtil::camelize($propertyName); - return isset($this->$var) ? $this->$var : null; + return isset($this->{$var}) ? $this->{$var} : null; } /** @@ -1209,7 +1209,7 @@ public function get($propertyName) public function getOrDefault($propertyName, $defaultValue = null) { $var = PicoStringUtil::camelize($propertyName); - return isset($this->$var) ? $this->$var : $defaultValue; + return isset($this->{$var}) ? $this->{$var} : $defaultValue; } /** @@ -1247,7 +1247,7 @@ public function __get($propertyName) public function __isset($propertyName) { $propertyName = lcfirst($propertyName); - return isset($this->$propertyName); + return isset($this->{$propertyName}); } /** @@ -1259,7 +1259,7 @@ public function __isset($propertyName) public function __unset($propertyName) { $propertyName = lcfirst($propertyName); - unset($this->$propertyName); + unset($this->{$propertyName}); } /** @@ -1303,7 +1303,7 @@ public function copyValueFrom($source, $filter = null, $includeNull = false) * * @param string $propertyName Property name * @param bool $skipModifyNullProperties Skip modifying null properties - * @return self Returns the instance of the current object for method chaining. + * @return self Returns the current instance for method chaining. */ private function removeValue($propertyName, $skipModifyNullProperties = false) { @@ -1350,7 +1350,7 @@ public function defaultValue($snakeCase = false) { $col = $columnName; } - $defaultValue->$col = $this->_persistProp->fixData($column[self::KEY_VALUE], $column[self::KEY_PROPERTY_TYPE]); + $defaultValue->{$col} = $this->_persistProp->fixData($column[self::KEY_VALUE], $column[self::KEY_PROPERTY_TYPE]); } } } @@ -1370,7 +1370,7 @@ public function value($snakeCase = false) foreach ($this as $key => $val) { if(!in_array($key, $parentProps)) { - $value->$key = $val; + $value->{$key} = $val; } } if($snakeCase) @@ -1378,7 +1378,7 @@ public function value($snakeCase = false) $value2 = new stdClass; foreach ($value as $key => $val) { $key2 = PicoStringUtil::snakeize($key); - $value2->$key2 = PicoStringUtil::snakeizeObject($val); + $value2->{$key2} = PicoStringUtil::snakeizeObject($val); } return $value2; } @@ -2386,27 +2386,27 @@ public function __call($method, $params) // NOSONAR { if (strncasecmp($method, "hasValue", 8) === 0) { $var = lcfirst(substr($method, 8)); - return isset($this->$var); + return isset($this->{$var}); } else if (strncasecmp($method, "isset", 5) === 0) { $var = lcfirst(substr($method, 5)); - return isset($this->$var); + return isset($this->{$var}); } else if (strncasecmp($method, "is", 2) === 0) { $var = lcfirst(substr($method, 2)); - return isset($this->$var) ? $this->$var == 1 : false; + return isset($this->{$var}) ? $this->{$var} == 1 : false; } else if (strncasecmp($method, "equals", 6) === 0) { $var = lcfirst(substr($method, 6)); - return isset($this->$var) && $this->$var == $params[0]; + return isset($this->{$var}) && $this->{$var} == $params[0]; } else if (strncasecmp($method, "get", 3) === 0) { $var = lcfirst(substr($method, 3)); - return isset($this->$var) ? $this->$var : null; + return isset($this->{$var}) ? $this->{$var} : null; } else if (strncasecmp($method, "set", 3) === 0 && isset($params) && is_array($params) && !empty($params) && !$this->_readonly) { $var = lcfirst(substr($method, 3)); - $this->$var = $params[0]; + $this->{$var} = $params[0]; $this->modifyNullProperties($var, $params[0]); return $this; } @@ -2569,32 +2569,32 @@ public function __call($method, $params) // NOSONAR else if (strncasecmp($method, "createSelected", 14) === 0) { $var = lcfirst(substr($method, 14)); if(isset($params) && isset($params[0])) { - return isset($this->$var) && $this->$var == $params[0] ? self::ATTR_SELECTED : ''; + return isset($this->{$var}) && $this->{$var} == $params[0] ? self::ATTR_SELECTED : ''; } else { - return isset($this->$var) && $this->$var == 1 ? self::ATTR_SELECTED : ''; + return isset($this->{$var}) && $this->{$var} == 1 ? self::ATTR_SELECTED : ''; } } else if (strncasecmp($method, "createChecked", 13) === 0) { $var = lcfirst(substr($method, 13)); if(isset($params) && isset($params[0])) { - return isset($this->$var) && $this->$var == $params[0] ? self::ATTR_CHECKED : ''; + return isset($this->{$var}) && $this->{$var} == $params[0] ? self::ATTR_CHECKED : ''; } else { - return isset($this->$var) && $this->$var == 1 ? self::ATTR_CHECKED : ''; + return isset($this->{$var}) && $this->{$var} == 1 ? self::ATTR_CHECKED : ''; } } else if (strncasecmp($method, "startsWith", 10) === 0) { $var = lcfirst(substr($method, 10)); $value = $params[0]; $caseSensitive = isset($params[1]) && $params[1]; - $haystack = $this->$var; + $haystack = $this->{$var}; return PicoStringUtil::startsWith($haystack, $value, $caseSensitive); } else if (strncasecmp($method, "endsWith", 8) === 0) { $var = lcfirst(substr($method, 8)); $value = $params[0]; $caseSensitive = isset($params[1]) && $params[1]; - $haystack = $this->$var; + $haystack = $this->{$var}; return PicoStringUtil::endsWith($haystack, $value, $caseSensitive); } else if (strncasecmp($method, "label", 5) === 0) { @@ -2621,23 +2621,23 @@ public function __call($method, $params) // NOSONAR } else if(strncasecmp($method, "option", 6) === 0) { $var = lcfirst(substr($method, 6)); - return isset($this->$var) && ($this->$var == 1 || $this->$var === true) ? $params[0] : $params[1]; + return isset($this->{$var}) && ($this->{$var} == 1 || $this->{$var} === true) ? $params[0] : $params[1]; } else if(strncasecmp($method, "notNull", 7) === 0) { $var = lcfirst(substr($method, 7)); - return isset($this->$var); + return isset($this->{$var}); } else if(strncasecmp($method, "notEmpty", 8) === 0) { $var = lcfirst(substr($method, 8)); - return isset($this->$var) && !empty($this->$var); + return isset($this->{$var}) && !empty($this->{$var}); } else if(strncasecmp($method, "notZero", 7) === 0) { $var = lcfirst(substr($method, 7)); - return isset($this->$var) && $this->$var != 0; + return isset($this->{$var}) && $this->{$var} != 0; } else if (strncasecmp($method, "notEquals", 9) === 0) { $var = lcfirst(substr($method, 9)); - return isset($this->$var) && $this->$var != $params[0]; + return isset($this->{$var}) && $this->{$var} != $params[0]; } } diff --git a/src/Request/InputCookie.php b/src/Request/InputCookie.php index 02f9e526..5d283feb 100644 --- a/src/Request/InputCookie.php +++ b/src/Request/InputCookie.php @@ -54,7 +54,7 @@ public static function requestCookie() * * @param array $data Data to load into the object. * @param bool $tolower Flag to indicate if the keys should be converted to lowercase (default is false). - * @return self Returns the instance of the current object. + * @return self Returns the current instance for method chaining. */ public function loadData($data, $tolower = false) { diff --git a/src/Request/InputEnv.php b/src/Request/InputEnv.php index 515595a5..84c07d25 100644 --- a/src/Request/InputEnv.php +++ b/src/Request/InputEnv.php @@ -37,7 +37,7 @@ public function __construct($recursive = false, $parseNullAndBool = false, $forc * * @param array $data Data to load into the object. * @param bool $tolower Flag to indicate if the keys should be converted to lowercase (default is false). - * @return self Returns the instance of the current object. + * @return self Returns the current instance for method chaining. */ public function loadData($data, $tolower = false) { diff --git a/src/Request/InputGet.php b/src/Request/InputGet.php index 29a54e3d..831abeb6 100644 --- a/src/Request/InputGet.php +++ b/src/Request/InputGet.php @@ -47,7 +47,7 @@ public static function requestGet() * * @param array $data Data to load into the object. * @param bool $tolower Flag to indicate if the keys should be converted to lowercase (default is false). - * @return self Returns the instance of the current object. + * @return self Returns the current instance for method chaining. */ public function loadData($data, $tolower = false) { diff --git a/src/Request/InputPost.php b/src/Request/InputPost.php index eb2ec138..22f87cd2 100644 --- a/src/Request/InputPost.php +++ b/src/Request/InputPost.php @@ -47,7 +47,7 @@ public static function requestPost() * * @param array $data Data to load into the object. * @param bool $tolower Flag to indicate if the keys should be converted to lowercase (default is false). - * @return self Returns the instance of the current object. + * @return self Returns the current instance for method chaining. */ public function loadData($data, $tolower = false) { diff --git a/src/Request/InputRequest.php b/src/Request/InputRequest.php index 11a1eb78..a937a066 100644 --- a/src/Request/InputRequest.php +++ b/src/Request/InputRequest.php @@ -37,7 +37,7 @@ public function __construct($recursive = false, $parseNullAndBool = false, $forc * * @param array $data Data to load into the object. * @param bool $tolower Flag to indicate if the keys should be converted to lowercase (default is false). - * @return self Returns the instance of the current object. + * @return self Returns the current instance for method chaining. */ public function loadData($data, $tolower = false) { diff --git a/src/Request/PicoRequestBase.php b/src/Request/PicoRequestBase.php index 3f8b6a19..30deac0d 100644 --- a/src/Request/PicoRequestBase.php +++ b/src/Request/PicoRequestBase.php @@ -90,7 +90,7 @@ public function loadData($data, $tolower = false) public function set($propertyName, $propertyValue) { $var = PicoStringUtil::camelize($propertyName); - $this->$var = $propertyValue; + $this->{$var} = $propertyValue; return $this; } @@ -104,7 +104,7 @@ public function set($propertyName, $propertyValue) public function get($propertyName, $params = null) { $var = PicoStringUtil::camelize($propertyName); - $value = isset($this->$var) ? $this->$var : null; + $value = isset($this->{$var}) ? $this->{$var} : null; if(isset($params) && !empty($params)) { $filter = $params[0]; @@ -142,7 +142,7 @@ public function value($snakeCase = false) { if(!in_array($key, $parentProps)) { - $value->$key = $val; + $value->{$key} = $val; } } if($snakeCase) @@ -151,7 +151,7 @@ public function value($snakeCase = false) foreach ($value as $key => $val) { $key2 = PicoStringUtil::snakeize($key); - $value2->$key2 = $val; + $value2->{$key2} = $val; } return $value2; } @@ -611,17 +611,17 @@ public function __call($method, $params) //NOSONAR if (strncasecmp($method, "countable", 9) === 0) { $var = lcfirst(substr($method, 9)); - return isset($this->$var) && is_array($this->$var); + return isset($this->{$var}) && is_array($this->{$var}); } else if (strncasecmp($method, "isset", 5) === 0) { $var = lcfirst(substr($method, 5)); - return isset($this->$var); + return isset($this->{$var}); } else if (strncasecmp($method, "is", 2) === 0) { $var = lcfirst(substr($method, 2)); - return isset($this->$var) && ($this->$var == 1 || strtolower($this->$var) == 'true'); + return isset($this->{$var}) && ($this->{$var} == 1 || strtolower($this->{$var}) == 'true'); } else if (strncasecmp($method, "get", 3) === 0) { @@ -631,44 +631,44 @@ public function __call($method, $params) //NOSONAR else if (strncasecmp($method, "set", 3) === 0) { $var = lcfirst(substr($method, 3)); - $this->$var = $params[0]; + $this->{$var} = $params[0]; return $this; } else if (strncasecmp($method, "equals", 6) === 0) { $var = lcfirst(substr($method, 6)); - $value = isset($this->$var) ? $this->$var : null; + $value = isset($this->{$var}) ? $this->{$var} : null; return isset($params[0]) && $params[0] == $value; } else if (strncasecmp($method, "checkbox", 8) === 0) { $var = lcfirst(substr($method, 8)); - $this->$var = isset($this->$var) ? $this->$var : $params[0]; + $this->{$var} = isset($this->{$var}) ? $this->{$var} : $params[0]; return $this; } else if (strncasecmp($method, "filter", 6) === 0) { $var = lcfirst(substr($method, 6)); - if(isset($this->$var)) + if(isset($this->{$var})) { - $this->$var = $this->applyFilter($this->$var, $params[0]); + $this->{$var} = $this->applyFilter($this->{$var}, $params[0]); } return $this; } else if (strncasecmp($method, "createSelected", 14) === 0) { $var = lcfirst(substr($method, 14)); - if(isset($this->$var)) + if(isset($this->{$var})) { - return $this->$var == $params[0] ? ' selected="selected"' : ''; + return $this->{$var} == $params[0] ? ' selected="selected"' : ''; } } else if (strncasecmp($method, "createChecked", 13) === 0) { $var = lcfirst(substr($method, 13)); - if(isset($this->$var)) + if(isset($this->{$var})) { - return $this->$var == $params[0] ? ' checked="checked"' : ''; + return $this->{$var} == $params[0] ? ' checked="checked"' : ''; } } else if (strncasecmp($method, "unset", 5) === 0) { $var = lcfirst(substr($method, 5)); - unset($this->$var); + unset($this->{$var}); return $this; } } diff --git a/src/SecretObject.php b/src/SecretObject.php index 46512f92..e32281b3 100644 --- a/src/SecretObject.php +++ b/src/SecretObject.php @@ -248,11 +248,11 @@ public function __call($method, $params) // NOSONAR { if (strncasecmp($method, "isset", 5) === 0) { $var = lcfirst(substr($method, 5)); - return isset($this->$var); + return isset($this->{$var}); } else if (strncasecmp($method, "is", 2) === 0) { $var = lcfirst(substr($method, 2)); - return isset($this->$var) ? $this->$var == 1 : false; + return isset($this->{$var}) ? $this->{$var} == 1 : false; } else if (strncasecmp($method, "get", 3) === 0) { $var = lcfirst(substr($method, 3)); return $this->_get($var); @@ -271,21 +271,21 @@ public function __call($method, $params) // NOSONAR } else if (strncasecmp($method, "push", 4) === 0 && isset($params) && is_array($params) && !$this->_readonly) { $var = lcfirst(substr($method, 4)); - if(!isset($this->$var)) + if(!isset($this->{$var})) { - $this->$var = array(); + $this->{$var} = array(); } - if(is_array($this->$var)) + if(is_array($this->{$var})) { - array_push($this->$var, isset($params) && is_array($params) && isset($params[0]) ? $params[0] : null); + array_push($this->{$var}, isset($params) && is_array($params) && isset($params[0]) ? $params[0] : null); } return $this; } else if (strncasecmp($method, "pop", 3) === 0) { $var = lcfirst(substr($method, 3)); - if(isset($this->$var) && is_array($this->$var)) + if(isset($this->{$var}) && is_array($this->{$var})) { - return array_pop($this->$var); + return array_pop($this->{$var}); } return null; } @@ -311,7 +311,7 @@ private function _set($var, $value) { $value = $this->decryptValue($value, $this->secureKey()); } - $this->$var = $value; + $this->{$var} = $value; return $this; } @@ -348,7 +348,7 @@ private function _get($var) */ private function _getValue($var) { - return isset($this->$var) ? $this->$var : null; + return isset($this->{$var}) ? $this->{$var} : null; } /** @@ -409,7 +409,7 @@ public function encryptValue($data, $hexKey = null) { foreach($data as $key=>$value) { - $data->$key = $this->encryptValue($value, $hexKey); + $data->{$key} = $this->encryptValue($value, $hexKey); } } else if(is_array($data)) @@ -478,7 +478,7 @@ public function decryptValue($data, $hexKey = null) { foreach($data as $key=>$value) { - $data->$key = $this->decryptValue($value, $hexKey); + $data->{$key} = $this->decryptValue($value, $hexKey); } } else if(is_array($data)) @@ -579,7 +579,7 @@ private function needInputDecryption($var) * array, or scalar value. * * @param mixed $data The data to load. - * @return self Returns the current object instance. + * @return self Returns the current instance for method chaining. */ public function loadData($data) { @@ -610,7 +610,7 @@ public function loadData($data) * * @param string $rawData The raw INI data as a string. * @param bool $systemEnv Flag to indicate whether to use environment variable replacement. - * @return self Returns the current object instance. + * @return self Returns the current instance for method chaining. */ public function loadIniString($rawData, $systemEnv = false) { @@ -636,7 +636,7 @@ public function loadIniString($rawData, $systemEnv = false) * * @param string $path The path to the INI file. * @param bool $systemEnv Flag to indicate whether to use environment variable replacement. - * @return self Returns the current object instance. + * @return self Returns the current instance for method chaining. */ public function loadIniFile($path, $systemEnv = false) { @@ -664,7 +664,7 @@ public function loadIniFile($path, $systemEnv = false) * @param bool $systemEnv Flag to indicate whether to replace environment variables. * @param bool $asObject Flag to indicate whether to return results as an object. * @param bool $recursive Flag to indicate whether to convert nested objects to MagicObject. - * @return self Returns the current object instance. + * @return self Returns the current instance for method chaining. */ public function loadYamlString($rawData, $systemEnv = false, $asObject = false, $recursive = false) { @@ -699,7 +699,7 @@ public function loadYamlString($rawData, $systemEnv = false, $asObject = false, * @param bool $systemEnv Flag to indicate whether to replace environment variables. * @param bool $asObject Flag to indicate whether to return results as an object. * @param bool $recursive Flag to indicate whether to convert nested objects to MagicObject. - * @return self Returns the current object instance. + * @return self Returns the current instance for method chaining. */ public function loadYamlFile($path, $systemEnv = false, $asObject = false, $recursive = false) { @@ -733,7 +733,7 @@ public function loadYamlFile($path, $systemEnv = false, $asObject = false, $recu * @param string $rawData The JSON data as a string. * @param bool $systemEnv Flag to indicate whether to replace environment variables. * @param bool $recursive Flag to create recursive object. - * @return self Returns the current object instance. + * @return self Returns the current instance for method chaining. */ public function loadJsonString($rawData, $systemEnv = false, $asObject = false, $recursive = false) { @@ -767,7 +767,7 @@ public function loadJsonString($rawData, $systemEnv = false, $asObject = false, * @param string $path The path to the JSON file. * @param bool $systemEnv Flag to indicate whether to replace environment variables. * @param bool $recursive Flag to create recursive object. - * @return self Returns the current object instance. + * @return self Returns the current instance for method chaining. */ public function loadJsonFile($path, $systemEnv = false, $asObject = false, $recursive = false) { @@ -799,7 +799,7 @@ public function loadJsonFile($path, $systemEnv = false, $asObject = false, $recu * but the loadData method will still work. * * @param bool $readonly Flag to set the object to read-only. - * @return self Returns the current object instance. + * @return self Returns the current instance for method chaining. */ protected function readOnly($readonly) { @@ -812,7 +812,7 @@ protected function readOnly($readonly) * * @param string $propertyName The name of the property to set. * @param mixed|null $propertyValue The value to set for the property. - * @return self Returns the current object instance. + * @return self Returns the current instance for method chaining. */ public function set($propertyName, $propertyValue) { @@ -824,16 +824,16 @@ public function set($propertyName, $propertyValue) * * @param string $propertyName The name of the property. * @param mixed $propertyValue The value to add. - * @return self Returns the current object instance. + * @return self Returns the current instance for method chaining. */ public function push($propertyName, $propertyValue) { $var = PicoStringUtil::camelize($propertyName); - if(!isset($this->$var)) + if(!isset($this->{$var})) { - $this->$var = array(); + $this->{$var} = array(); } - array_push($this->$var, $propertyValue); + array_push($this->{$var}, $propertyValue); return $this; } @@ -846,9 +846,9 @@ public function push($propertyName, $propertyValue) public function pop($propertyName) { $var = PicoStringUtil::camelize($propertyName); - if(isset($this->$var) && is_array($this->$var)) + if(isset($this->{$var}) && is_array($this->{$var})) { - return array_pop($this->$var); + return array_pop($this->{$var}); } return null; } @@ -874,7 +874,7 @@ public function get($propertyName) public function getOrDefault($propertyName, $defaultValue = null) { $var = PicoStringUtil::camelize($propertyName); - return isset($this->$var) ? $this->$var : $defaultValue; + return isset($this->{$var}) ? $this->{$var} : $defaultValue; } /** @@ -889,7 +889,7 @@ public function getOrDefault($propertyName, $defaultValue = null) * should be copied. If null, all properties will be considered. * @param bool $includeNull A flag indicating whether to include properties with null * values. Defaults to false, meaning null values will be excluded. - * @return self Returns the current object instance for method chaining. + * @return self Returns the current instance for method chaining. */ public function copyValueFrom($source, $filter = null, $includeNull = false) { @@ -936,7 +936,7 @@ public function value($snakeCase = false) if(!in_array($key, $parentProps)) { // get decripted or encrypted value - $value->$key = $this->_get($key); + $value->{$key} = $this->_get($key); } } if($snakeCase) @@ -945,7 +945,7 @@ public function value($snakeCase = false) foreach ($value as $key => $val) { $key2 = PicoStringUtil::snakeize($key); // get decripted or encrypted value - $value2->$key2 = PicoStringUtil::snakeizeObject($val); + $value2->{$key2} = PicoStringUtil::snakeizeObject($val); } return $value2; } @@ -1103,7 +1103,7 @@ function($property) use($class) { * * @param string $propertyName The name of the property. * @param mixed $propertyValue The value of the property. - * @return self Returns the current object instance. + * @return self Returns the current instance for method chaining. */ private function modifyNullProperties($propertyName, $propertyValue) { diff --git a/src/Session/PicoSession.php b/src/Session/PicoSession.php index 3c97e9da..83b12e4e 100644 --- a/src/Session/PicoSession.php +++ b/src/Session/PicoSession.php @@ -172,7 +172,7 @@ public function destroy() * @param bool $secure Indicates if the cookie should only be transmitted over a secure HTTPS connection. * @param bool $httponly Indicates if the cookie is accessible only through the HTTP protocol. * @param string $samesite The SameSite attribute of the cookie (Lax, Strict, None). - * @return self The current instance for method chaining. + * @return self Returns the current instance for method chaining. */ public function setSessionCookieParams($maxlifetime, $secure, $httponly, $samesite = self::SAME_SITE_STRICT) { @@ -202,7 +202,7 @@ public function setSessionCookieParams($maxlifetime, $secure, $httponly, $samesi * @param bool $secure Indicates if the cookie should only be transmitted over a secure HTTPS connection. * @param bool $httponly Indicates if the cookie is accessible only through the HTTP protocol. * @param string $samesite The SameSite attribute of the cookie (Lax, Strict, None). - * @return self The current instance for method chaining. + * @return self Returns the current instance for method chaining. */ public function setSessionCookieSameSite($name, $value, $expire, $path, $domain, $secure, $httponly, $samesite = self::SAME_SITE_STRICT) { @@ -225,7 +225,7 @@ public function setSessionCookieSameSite($name, $value, $expire, $path, $domain, * Sets the session name. * * @param string $name The name of the session. - * @return self The current instance for method chaining. + * @return self Returns the current instance for method chaining. */ public function setSessionName($name) { @@ -248,7 +248,7 @@ public function setSessionSavePath($path) * Sets the maximum lifetime for the session. * * @param int $lifeTime Maximum lifetime for the session in seconds. - * @return self The current instance for method chaining. + * @return self Returns the current instance for method chaining. */ public function setSessionMaxLifeTime($lifeTime) { @@ -263,7 +263,7 @@ public function setSessionMaxLifeTime($lifeTime) * @param string $host Redis host. * @param int $port Redis port. * @param string $auth Redis authentication. - * @return self The current instance for method chaining. + * @return self Returns the current instance for method chaining. */ public function saveToRedis($host, $port, $auth) { @@ -277,7 +277,7 @@ public function saveToRedis($host, $port, $auth) * Saves the session to files. * * @param string $path The directory where session files will be stored. - * @return self The current instance for method chaining. + * @return self Returns the current instance for method chaining. */ public function saveToFiles($path) { @@ -300,7 +300,7 @@ public function getSessionId() * Sets a new session ID. * * @param string $id The new session ID. - * @return self The current instance for method chaining. + * @return self Returns the current instance for method chaining. */ public function setSessionId($id) { diff --git a/src/SetterGetter.php b/src/SetterGetter.php index 22244989..03b69373 100644 --- a/src/SetterGetter.php +++ b/src/SetterGetter.php @@ -109,7 +109,7 @@ public function loadData($data) public function set($propertyName, $propertyValue) { $var = PicoStringUtil::camelize($propertyName); - $this->$var = $propertyValue; + $this->{$var} = $propertyValue; return $this; } @@ -125,11 +125,11 @@ public function set($propertyName, $propertyValue) public function push($propertyName, $propertyValue) { $var = PicoStringUtil::camelize($propertyName); - if(!isset($this->$var)) + if(!isset($this->{$var})) { - $this->$var = array(); + $this->{$var} = array(); } - array_push($this->$var, $propertyValue); + array_push($this->{$var}, $propertyValue); return $this; } @@ -142,9 +142,9 @@ public function push($propertyName, $propertyValue) public function pop($propertyName) { $var = PicoStringUtil::camelize($propertyName); - if(isset($this->$var) && is_array($this->$var)) + if(isset($this->{$var}) && is_array($this->{$var})) { - return array_pop($this->$var); + return array_pop($this->{$var}); } return null; } @@ -158,7 +158,7 @@ public function pop($propertyName) public function get($propertyName) { $var = PicoStringUtil::camelize($propertyName); - return isset($this->$var) ? $this->$var : null; + return isset($this->{$var}) ? $this->{$var} : null; } /** @@ -200,7 +200,7 @@ public function __get($name) */ public function __isset($name) { - return isset($this->$name) ? $this->$name : null; + return isset($this->{$name}) ? $this->{$name} : null; } /** @@ -213,7 +213,7 @@ public function __isset($name) */ public function __unset($name) { - unset($this->$name); + unset($this->{$name}); } /** @@ -232,7 +232,7 @@ public function value($snakeCase = false) { if(!in_array($key, $parentProps)) { - $value->$key = $val; + $value->{$key} = $val; } } if($snakeCase) @@ -241,7 +241,7 @@ public function value($snakeCase = false) foreach ($value as $key => $val) { $key2 = PicoStringUtil::snakeize($key); - $value2->$key2 = $val; + $value2->{$key2} = $val; } return $value2; } @@ -328,22 +328,22 @@ public function __call($method, $params) //NOSONAR if (strncasecmp($method, "isset", 5) === 0) { $var = lcfirst(substr($method, 5)); - return isset($this->$var); + return isset($this->{$var}); } else if (strncasecmp($method, "is", 2) === 0) { $var = lcfirst(substr($method, 2)); - return isset($this->$var) ? $this->$var == 1 : false; + return isset($this->{$var}) ? $this->{$var} == 1 : false; } else if (strncasecmp($method, "get", 3) === 0) { $var = lcfirst(substr($method, 3)); - return isset($this->$var) ? $this->$var : null; + return isset($this->{$var}) ? $this->{$var} : null; } else if (strncasecmp($method, "set", 3) === 0) { $var = lcfirst(substr($method, 3)); - $this->$var = $params[0]; + $this->{$var} = $params[0]; return $this; } else if (strncasecmp($method, "unset", 5) === 0) @@ -354,21 +354,21 @@ public function __call($method, $params) //NOSONAR } else if (strncasecmp($method, "push", 4) === 0) { $var = lcfirst(substr($method, 4)); - if(!isset($this->$var)) + if(!isset($this->{$var})) { - $this->$var = array(); + $this->{$var} = array(); } - if(is_array($this->$var)) + if(is_array($this->{$var})) { - array_push($this->$var, isset($params) && is_array($params) && isset($params[0]) ? $params[0] : null); + array_push($this->{$var}, isset($params) && is_array($params) && isset($params[0]) ? $params[0] : null); } return $this; } else if (strncasecmp($method, "pop", 3) === 0) { $var = lcfirst(substr($method, 3)); - if(isset($this->$var) && is_array($this->$var)) + if(isset($this->{$var}) && is_array($this->{$var})) { - return array_pop($this->$var); + return array_pop($this->{$var}); } return null; } diff --git a/src/Txt.php b/src/Txt.php new file mode 100644 index 00000000..41ea42fc --- /dev/null +++ b/src/Txt.php @@ -0,0 +1,29 @@ +$var = $propertyValue; + $this->{$var} = $propertyValue; return $this; } @@ -102,7 +102,7 @@ public function set($propertyName, $propertyValue) public function get($propertyName) { $var = PicoStringUtil::camelize($propertyName); - return isset($this->$var) ? $this->$var : null; + return isset($this->{$var}) ? $this->{$var} : null; } /** @@ -160,7 +160,7 @@ public function __get($name) */ public function __isset($name) { - return isset($this->$name) ? $this->$name : null; + return isset($this->{$name}) ? $this->{$name} : null; } /** @@ -176,7 +176,7 @@ public function __isset($name) */ public function __unset($name) { - unset($this->$name); + unset($this->{$name}); return $this; } @@ -211,22 +211,22 @@ public function __call($method, $params) //NOSONAR if (strncasecmp($method, "isset", 5) === 0) { $var = lcfirst(substr($method, 5)); - return isset($this->$var); + return isset($this->{$var}); } else if (strncasecmp($method, "is", 2) === 0) { $var = lcfirst(substr($method, 2)); - return isset($this->$var) ? $this->$var == 1 : false; + return isset($this->{$var}) ? $this->{$var} == 1 : false; } else if (strncasecmp($method, "get", 3) === 0) { $var = lcfirst(substr($method, 3)); - return isset($this->$var) ? $this->$var : null; + return isset($this->{$var}) ? $this->{$var} : null; } else if (strncasecmp($method, "set", 3) === 0) { $var = lcfirst(substr($method, 3)); - $this->$var = $params[0]; + $this->{$var} = $params[0]; return $this; } else if (strncasecmp($method, "unset", 5) === 0) diff --git a/tests/entity/Music/Dto/DtoSong.php b/tests/entity/Music/Dto/DtoSong.php index a86af9cc..6c23dbf0 100644 --- a/tests/entity/Music/Dto/DtoSong.php +++ b/tests/entity/Music/Dto/DtoSong.php @@ -405,7 +405,7 @@ class DtoSong extends SetterGetter * Construct DtoSong from EntitySong and not copy other properties * * @param EntitySong $input - * @return self + * @return self Returns the current instance for method chaining. */ public static function valueOf($input) { diff --git a/tests/txt.php b/tests/txt.php new file mode 100644 index 00000000..66f4957e --- /dev/null +++ b/tests/txt.php @@ -0,0 +1,7 @@ +