diff --git a/dist/twist/Classes/Autoload.class.php b/dist/twist/Classes/Autoload.class.php index c6d5280d..be3ebacc 100755 --- a/dist/twist/Classes/Autoload.class.php +++ b/dist/twist/Classes/Autoload.class.php @@ -35,7 +35,7 @@ class Autoload{ /** * Initialise the AutoLoader and register the class as an AutoLoader - * @param $strBaseDir Base directory of the framework + * @param string $strBaseDir Base directory of the framework */ public static function init($strBaseDir){ self::$strBaseDir = $strBaseDir; @@ -44,7 +44,7 @@ public static function init($strBaseDir){ /** * Handler for each individual request, the path for the required file will be worked out here - * @param $strRequest The full class and namespace of the file to be loaded + * @param string $strRequest The full class and namespace of the file to be loaded * @throws \Exception */ public static function load($strRequest){ diff --git a/dist/twist/Classes/Error.class.php b/dist/twist/Classes/Error.class.php index 4104b94e..ccfece53 100644 --- a/dist/twist/Classes/Error.class.php +++ b/dist/twist/Classes/Error.class.php @@ -38,10 +38,10 @@ function __construct(){ /** * Get an array of the Apache request headers. - * @todo Needs to be re-written/optimised + * * @return array */ - public static function apacheRequestHeaders(){ + public static function apacheRequestHeaders(){ //TODO: Needs to be re-written/optimised $arrOut = array(); $regxHTTP = '/\AHTTP_/'; @@ -242,10 +242,10 @@ protected static function debugDataOutput($arrData){ /** * PHP Error handler to capture all PHP errors so that they can be logged to a file or output into the debug window later. - * @param $intErrorNo - * @param $strError - * @param $strErrorFile - * @param $intErrorLine + * @param integer $intErrorNo + * @param string $strError + * @param string $strErrorFile + * @param integer $intErrorLine */ public static function handleError($intErrorNo, $strError, $strErrorFile, $intErrorLine){ @@ -727,7 +727,7 @@ public static function outputLog(){ /** * Detect the error type as a string based on an error number. - * @param $intErrorNo + * @param integer $intErrorNo * @return string */ public static function getType($intErrorNo){ diff --git a/dist/twist/Classes/Instance.class.php b/dist/twist/Classes/Instance.class.php index 10ba0a56..37e4f869 100755 --- a/dist/twist/Classes/Instance.class.php +++ b/dist/twist/Classes/Instance.class.php @@ -61,7 +61,7 @@ public static function retrieveObject($strObjectKey){ /** * Removes the object from the instance holder and destroys the object. - * @param $strObjectKey + * @param string $strObjectKey */ public static function removeObject($strObjectKey){ unset(self::$arrFrameworkObjects[$strObjectKey]); diff --git a/dist/twist/Classes/Shutdown.class.php b/dist/twist/Classes/Shutdown.class.php index df41bc19..71492417 100755 --- a/dist/twist/Classes/Shutdown.class.php +++ b/dist/twist/Classes/Shutdown.class.php @@ -102,7 +102,7 @@ public static function callEvents(){ /** * Remove a registered even from the event list - * @param $strEventKey + * @param string $strEventKey */ public static function cancelEvent($strEventKey){ unset(self::$arrCallbackEvents[$strEventKey]); diff --git a/dist/twist/Core/Controllers/Base.controller.php b/dist/twist/Core/Controllers/Base.controller.php index d65db7e4..881a21e0 100755 --- a/dist/twist/Core/Controllers/Base.controller.php +++ b/dist/twist/Core/Controllers/Base.controller.php @@ -46,7 +46,7 @@ class Base{ * A function that is called by Routes both to ensure that the controller has been extended and so that we can pass in resources and information required by the controller. * * @param \Twist\Core\Utilities\Route $resRoute - * @param $arrRouteData + * @param array $arrRouteData * @return bool */ final public function _extended($resRoute,$arrRouteData){ @@ -102,6 +102,7 @@ public function _fallback(){ /** * Over-ride the base view for the current page only. * + * @param null $mxdBaseView * @return null|string */ public function _baseView($mxdBaseView = null){ @@ -181,7 +182,7 @@ public function _getReplacements(){ /** * Function to call any controller response with the correct method prefix if any has been setup. If the response function is not found a 404 page will be output. * - * @param $strCallFunctionName Name of the function to be called + * @param string $strCallFunctionName Name of the function to be called * @return bool */ final protected function _callFunction($strCallFunctionName){ @@ -224,7 +225,7 @@ public function _upload($strFileKey,$strType = 'file'){ $arrOut = array(); if(count($_FILES) && array_key_exists($strFileKey,$_FILES)){ - $resUpload = new \Twist\Core\Controllers\Upload(); + $resUpload = new Upload(); if(is_array($_FILES[$strFileKey]['name'])){ foreach($_FILES[$strFileKey]['name'] as $intKey => $mxdValue){ @@ -265,7 +266,7 @@ final public function _error($intError){ * @return bool */ final public function _response($intError,$strCustomDescription = null){ - Error::errorPage($intError,$strCustomDescription); + Error::response($intError,$strCustomDescription); return false; } @@ -344,7 +345,7 @@ protected function _var($strVarKey = null){ /** * Process a view template file and return the output. - * @param $dirView + * @param string $dirView * @param null $arrViewTags * @param bool $blRemoveUnusedTags * @return string @@ -355,6 +356,10 @@ protected function _view($dirView,$arrViewTags = null,$blRemoveUnusedTags = fals /** * @alias _view + * @param string $dirView + * @param null $arrViewTags + * @param bool $blRemoveUnusedTags + * @return string */ protected function _render($dirView,$arrViewTags = null,$blRemoveUnusedTags = false){ return $this->_view($dirView,$arrViewTags,$blRemoveUnusedTags); diff --git a/dist/twist/Core/Controllers/BaseAJAX.controller.php b/dist/twist/Core/Controllers/BaseAJAX.controller.php index 746f4343..ef7dacb4 100755 --- a/dist/twist/Core/Controllers/BaseAJAX.controller.php +++ b/dist/twist/Core/Controllers/BaseAJAX.controller.php @@ -40,7 +40,7 @@ public function _baseCalls(){ /** * Set the status for the Ajax response, true by default * - * @param $blStatus + * @param bool $blStatus */ public function _ajaxStatus($blStatus){ $this->blAjaxResponse = ($blStatus !== false); @@ -62,7 +62,7 @@ public function _ajaxFail(){ /** * Set a message to be returned to the Ajax call, can be used for an error message - * @param $strMessage + * @param string $strMessage */ public function _ajaxMessage($strMessage=''){ $this->strAjaxResponseMessage = $strMessage; @@ -71,6 +71,7 @@ public function _ajaxMessage($strMessage=''){ /** * Encode the response of the AJAX output * @param array $mxdData + * @param bool $blDebug * @return string */ public function _ajaxRespond($mxdData=array(), $blDebug = false){ diff --git a/dist/twist/Core/Controllers/InstallWizard.controller.php b/dist/twist/Core/Controllers/InstallWizard.controller.php index 18c428e3..574e12f7 100755 --- a/dist/twist/Core/Controllers/InstallWizard.controller.php +++ b/dist/twist/Core/Controllers/InstallWizard.controller.php @@ -314,7 +314,6 @@ public function user(){ /** * Pre-install some packages and setup some systems like the manager * Currently skips this step in initial release of V3 - * @return string */ public function package(){ @@ -354,7 +353,7 @@ public function package(){ } if($arrSession['user']['status']){ - //@todo Skip the interfaces step for the time being, it will become packages when ready + //TODO: Skip the interfaces step for the time being, it will become packages when ready header('Location: finish'); }else{ header('Location: user'); diff --git a/dist/twist/Core/Controllers/Manager.controller.php b/dist/twist/Core/Controllers/Manager.controller.php index 13fdff12..13009968 100755 --- a/dist/twist/Core/Controllers/Manager.controller.php +++ b/dist/twist/Core/Controllers/Manager.controller.php @@ -135,7 +135,7 @@ public function cache(){ /** * Run through all the cache files and build up a list of what has been cached - * @param $strCacheFolder + * @param string $strCacheFolder */ protected function parseCache($strCacheFolder){ diff --git a/dist/twist/Core/Controllers/Placeholder.controller.php b/dist/twist/Core/Controllers/Placeholder.controller.php index 0edddce8..422b0b1a 100755 --- a/dist/twist/Core/Controllers/Placeholder.controller.php +++ b/dist/twist/Core/Controllers/Placeholder.controller.php @@ -57,8 +57,8 @@ public function _index(){ $intPadding = 10; $intThickness = 5; - $intStartX = $intPadding; - $intStartY = $intPadding; + //$intStartX = $intPadding; + //$intStartY = $intPadding; $intEndX = $intWidth - $intPadding; $intEndY = $intHeight - $intPadding; diff --git a/dist/twist/Core/Controllers/Upload.controller.php b/dist/twist/Core/Controllers/Upload.controller.php index c07051d7..a5549f65 100755 --- a/dist/twist/Core/Controllers/Upload.controller.php +++ b/dist/twist/Core/Controllers/Upload.controller.php @@ -131,7 +131,7 @@ public function asset($strFileKey = null,$intIndex = null){ protected function storeFile($strFileKey = null,$intIndex = null){ if(is_array($_FILES) && count($_FILES)){ - $arrOut = \Twist::File()->upload($strFileKey,null,$intIndex); + $arrOut = \Twist::File()->upload($strFileKey,null,$intIndex); //TODO: Is $intIndex used? }else{ $arrOut = \Twist::File()->uploadPUT(); } diff --git a/dist/twist/Core/Models/Archive/Native.model.php b/dist/twist/Core/Models/Archive/Native.model.php index 74f0c8e4..d553849d 100755 --- a/dist/twist/Core/Models/Archive/Native.model.php +++ b/dist/twist/Core/Models/Archive/Native.model.php @@ -30,7 +30,7 @@ class Native{ /** * Create an archive resource ready to accept files and folders - * @param $strZipArchive + * @param string $strZipArchive * @return boolean */ public function create($strZipArchive){ @@ -41,7 +41,7 @@ public function create($strZipArchive){ /** * Load in an existing archive and store it as a resource ready to be manipulated/extracted. - * @param $strZipArchive + * @param string $strZipArchive * @return boolean */ public function load($strZipArchive){ @@ -52,8 +52,8 @@ public function load($strZipArchive){ /** * Add a file to the archive resource - * @param $strLocalFile - * @param $strZipPath + * @param string $strLocalFile + * @param string $strZipPath */ public function addFile($strLocalFile,$strZipPath){ $this->resZip->addFile($strLocalFile,$strZipPath); @@ -61,7 +61,7 @@ public function addFile($strLocalFile,$strZipPath){ /** * Extract the files from the archive resource - * @param $strExtractPath + * @param string $strExtractPath */ public function extract($strExtractPath){ $this->resZip->extractTo($strExtractPath); @@ -69,7 +69,7 @@ public function extract($strExtractPath){ /** * Add an empty folder to the archive resource - * @param $strDirectoryPath + * @param string $strDirectoryPath */ public function addEmptyDir($strDirectoryPath){ $this->resZip->addEmptyDir($strDirectoryPath); @@ -77,7 +77,7 @@ public function addEmptyDir($strDirectoryPath){ /** * Set a comment in the archive comment field, the comment can be seen when extracting the archive on commandline or using certain GUI tools. - * @param $strComment + * @param string $strComment */ public function setArchiveComment($strComment){ $this->resZip->setArchiveComment($strComment); @@ -85,7 +85,7 @@ public function setArchiveComment($strComment){ /** * Delete a file or folder form the archive by its path. - * @param $strDirectoryPath + * @param string $strDirectoryPath */ public function deleteName($strDirectoryPath){ $this->resZip->deleteName($strDirectoryPath); diff --git a/dist/twist/Core/Models/Archive/PclZip.model.php b/dist/twist/Core/Models/Archive/PclZip.model.php index 7ef81cf8..5b8d960b 100755 --- a/dist/twist/Core/Models/Archive/PclZip.model.php +++ b/dist/twist/Core/Models/Archive/PclZip.model.php @@ -37,7 +37,7 @@ public function __construct(){ /** * Create an archive resource using the PclZip Third party package ready to accept files and folders - * @param $strZipArchive + * @param string $strZipArchive * @return mixed */ public function create($strZipArchive){ @@ -46,7 +46,7 @@ public function create($strZipArchive){ /** * Load in an existing archive using the PclZip Third party package and store it as a resource ready to be manipulated/extracted. - * @param $strZipArchive + * @param string $strZipArchive * @return boolean */ public function load($strZipArchive){ @@ -55,8 +55,8 @@ public function load($strZipArchive){ /** * Add a file to the archive resource using the PclZip Third party package. - * @param $strLocalFile - * @param $strZipPath + * @param string $strLocalFile + * @param string $strZipPath */ public function addFile($strLocalFile,$strZipPath){ @@ -68,7 +68,7 @@ public function addFile($strLocalFile,$strZipPath){ /** * Extract the files from the archive resource using the PclZip Third party package. - * @param $strExtractPath + * @param string $strExtractPath */ public function extract($strExtractPath){ return ($this->resZip->extract(PCLZIP_OPT_PATH, $strExtractPath) == 0) ? false : true; @@ -76,7 +76,7 @@ public function extract($strExtractPath){ /** * Add an empty folder to the archive resource using the PclZip Third party package. - * @param $strDirectoryPath + * @param string $strDirectoryPath */ public function addEmptyDir($strDirectoryPath){ $this->resZip->addEmptyDir($strDirectoryPath); @@ -84,7 +84,7 @@ public function addEmptyDir($strDirectoryPath){ /** * Set a comment in the archive comment field using the PclZip Third party package, the comment can be seen when extracting the archive on commandline or using certain GUI tools. - * @param $strComment + * @param string $strComment */ public function setArchiveComment($strComment){ $this->resZip->setArchiveComment($strComment); @@ -92,7 +92,7 @@ public function setArchiveComment($strComment){ /** * Delete a file or folder form the archive by its path using the PclZip Third party package. - * @param $strDirectoryPath + * @param string $strDirectoryPath */ public function deleteName($strDirectoryPath){ $this->resZip->deleteName($strDirectoryPath); diff --git a/dist/twist/Core/Models/Database/ProtocolJSON.model.php b/dist/twist/Core/Models/Database/ProtocolJSON.model.php index d835abde..2b475ddc 100755 --- a/dist/twist/Core/Models/Database/ProtocolJSON.model.php +++ b/dist/twist/Core/Models/Database/ProtocolJSON.model.php @@ -88,7 +88,7 @@ public function createTable($strTable,$arrFields,$strAutoIncrement = null){ ); $this->resDatabase['updated'] = date('Y-m-d H:i:s'); - $this->writeChanges(); + return $this->writeChanges(); } public function deleteTable($strTable){ @@ -97,7 +97,7 @@ public function deleteTable($strTable){ unset($this->resDatabase['tables'][$strTable]); $this->resDatabase['updated'] = date('Y-m-d H:i:s'); - $this->writeChanges(); + return $this->writeChanges(); } public function getTableInfo($strTable){ @@ -111,8 +111,8 @@ public function getTableInfo($strTable){ /** * Insert a record into a table - * @param $strTable - * @param $arrData + * @param string $strTable + * @param array $arrData * @return int */ public function insertRow($strTable,$arrData){ @@ -139,16 +139,18 @@ public function insertRow($strTable,$arrData){ //Add the array to the table $this->resDatabase['tables'][$strTable]['data'][] = $arrNewRow; $this->resDatabase['tables'][$strTable]['updated'] = date('Y-m-d H:i:s'); - $this->writeChanges(); + return $this->writeChanges(); } - return $intInsertID; + return null; } /** * Select record(s) from a table - * @param $strTable + * @param string $strTable * @param array $arrWhere + * @param array $arrOrder + * @param array $arrLimit * @return array */ public function selectRow($strTable,$arrWhere = array(),$arrOrder = array(),$arrLimit = array()){ @@ -194,11 +196,12 @@ public function selectRow($strTable,$arrWhere = array(),$arrOrder = array(),$arr /** * Update a record in a table - * @param $strTable + * @param string $strTable * @param array $arrData - * @param array $arrWhere] + * @param array $arrWhere + * @param array $arrLimit */ - public function updateRow($strTable,$arrData = array(),$arrWhere = array(),$arrLimit = array()){ + public function updateRow($strTable,$arrData = array(),$arrWhere = array(),$arrLimit = array()){ //TODO: $arrLimit isn't used $arrTable = $this->getTableInfo($strTable); @@ -220,12 +223,15 @@ public function updateRow($strTable,$arrData = array(),$arrWhere = array(),$arrL $this->resDatabase['tables'][$strTable]['updated'] = date('Y-m-d H:i:s'); $this->writeChanges(); } + + return true; } /** * Delete a record from a table - * @param $strTable + * @param string $strTable * @param array $arrWhere + * @param array $arrLimit */ public function deleteRow($strTable,$arrWhere = array(),$arrLimit = array()){ @@ -240,13 +246,13 @@ public function deleteRow($strTable,$arrWhere = array(),$arrLimit = array()){ } $this->resDatabase['tables'][$strTable]['updated'] = date('Y-m-d H:i:s'); - $this->writeChanges(); + return $this->writeChanges(); } /** * Test to see if the fields that are passed in are correct / valid - * @param $strTable - * @param $arrData + * @param string $strTable + * @param array $arrData * @return bool */ protected function testDataValidity($strTable,$arrData){ @@ -266,9 +272,9 @@ protected function testDataValidity($strTable,$arrData){ /** * Process each row to see if it matches the where requirements - * @param $strTable - * @param $arrDataRow - * @param $arrWhere + * @param string $strTable + * @param array $arrDataRow + * @param array $arrWhere * @return array|bool */ protected function processDataWhere($strTable,$arrDataRow,$arrWhere){ @@ -305,12 +311,12 @@ public function writeChanges($strDatabase = null){ $strWriteDB = (is_null($strDatabase)) ? $this->strCurrentDatabase : $strDatabase; $strDatabaseFile = sprintf("%s/%s.json",dirname(__FILE__),$strWriteDB); - file_put_contents($strDatabaseFile,json_encode($this->resDatabase)); + return file_put_contents($strDatabaseFile,json_encode($this->resDatabase)); } /** * Extract the table name form the query matches - * @param $arrMatches + * @param array $arrMatches * @return string */ protected function processQueryTable($arrMatches){ @@ -327,7 +333,7 @@ protected function processQueryTable($arrMatches){ /** * Extract the options/Data form the query matches - * @param $arrMatches + * @param array $arrMatches * @return array */ protected function processQueryOptions($arrMatches){ @@ -358,7 +364,7 @@ protected function processQueryOptions($arrMatches){ /** * Extract the Where data form the query matches - * @param $arrMatches + * @param array $arrMatches * @return array */ protected function processQueryWhere($arrMatches){ @@ -425,6 +431,9 @@ protected function processQueryLimit($arrMatches){ * PUBLIC FUNCTIONS */ + /** + * @param $resResult + */ function numberRows($resResult){ } @@ -488,6 +497,8 @@ function query($strQuery){ echo "
Parts: ".print_r($arrMatches,true)."

"; + $arrResult = array(); + switch(strtoupper($arrMatches['type'])){ case'CREATE': diff --git a/dist/twist/Core/Models/Database/ProtocolMYSQL.model.php b/dist/twist/Core/Models/Database/ProtocolMYSQL.model.php index e74690d6..1b8ea6ff 100755 --- a/dist/twist/Core/Models/Database/ProtocolMYSQL.model.php +++ b/dist/twist/Core/Models/Database/ProtocolMYSQL.model.php @@ -38,7 +38,7 @@ public function validConnectionObject(){ return (!is_null($this->resLink) && is_object($this->resLink)); } - public function connect($strServer,$strUsername,$strPassword,$strDatabase){ + public function connect($strServer,$strUsername,$strPassword,$strDatabase){ //TODO: $strDatabase not used $this->resLink = @mysql_connect($strServer,$strUsername,$strPassword); return $this->validConnectionObject(); } @@ -79,7 +79,7 @@ public function insertId(){ return ($this->validConnectionObject()) ? mysql_insert_id($this->resLink) : 0; } - public function affectedRows($resResult){ + public function affectedRows($resResult){ //TODO $resResult not used return ($this->validConnectionObject()) ? mysql_affected_rows($this->resLink) : 0; } diff --git a/dist/twist/Core/Models/Database/ProtocolMYSQLI.model.php b/dist/twist/Core/Models/Database/ProtocolMYSQLI.model.php index cd0a08c4..f42bacc3 100755 --- a/dist/twist/Core/Models/Database/ProtocolMYSQLI.model.php +++ b/dist/twist/Core/Models/Database/ProtocolMYSQLI.model.php @@ -38,88 +38,160 @@ class ProtocolMYSQLI{ public $blActiveTransaction = false; public $blAutoCommit = false; + /** + * @param string $strServer + * @param string $strUsername + * @param string $strPassword + * @param string $strDatabase + */ public function connect($strServer,$strUsername,$strPassword,$strDatabase){ $this->resLink = new \mysqli($strServer,$strUsername,$strPassword,$strDatabase); } + /** + * @return bool + */ public function connected(){ return (!is_null($this->resLink) && $this->ping()); } + /** + * @return bool + */ public function close(){ return $this->resLink->close(); } + /** + * @return string + */ public function connectionError(){ return $this->resLink->connect_error; } + /** + * @return bool + */ public function ping(){ return (!is_null($this->resLink) && is_object($this->resLink)) ? $this->resLink->ping() : false; } + /** + * @param string $strDatabase + * @return bool + */ public function selectDatabase($strDatabase){ return $this->resLink->select_db($strDatabase); } + /** + * @param string $strCharset + * @return bool + */ public function setCharset($strCharset){ return $this->resLink->set_charset($strCharset); } + /** + * @param string $strRawString + * @return string + */ public function escapeString($strRawString){ return $this->resLink->real_escape_string($strRawString); } + /** + * @param string $resResult + * @return integer + */ public function numberRows($resResult){ return (!is_null($resResult) && is_object($resResult)) ? $resResult->num_rows : 0; } + /** + * @return mixed + */ public function insertId(){ return $this->resLink->insert_id; } - public function affectedRows($resResult = null){ + /** + * @param null $resResult + * @return int + */ + public function affectedRows($resResult = null){ //TODO: $resResult not used return $this->resLink->affected_rows; } + /** + * @param string $strQuery + * @return bool|\mysqli_result + */ public function query($strQuery){ $resOut = $this->resLink->query($strQuery); $this->blActiveTransaction = ($this->blAutoCommit) ? false : true; return $resOut; } + /** + * @param \mysqli_result $resResult + * @return mixed + */ public function fetchArray(\mysqli_result $resResult){ return $resResult->fetch_array(MYSQLI_ASSOC); } + /** + * @param \mysqli_result $resResult + * @return bool + */ public function freeResult(\mysqli_result $resResult){ $resResult->free(); return true; } + /** + * @return string + */ public function errorString(){ return $this->resLink->error; } + /** + * @return integer + */ public function errorNumber(){ return $this->resLink->errno; } + /** + * @param bool $blEnable + * @return bool + */ public function autoCommit($blEnable = true){ $this->blAutoCommit = $blEnable; return (!is_null($this->resLink) && is_object($this->resLink)) ? $this->resLink->autocommit($blEnable) : false; } + /** + * @return bool + */ public function commit(){ $this->blActiveTransaction = false; return $this->resLink->commit(); } + /** + * @return bool + */ public function rollback(){ $this->blActiveTransaction = false; return $this->resLink->rollback(); } + /** + * @return string + */ public function serverInfo(){ return mysqli_get_server_info($this->resLink); } diff --git a/dist/twist/Core/Models/Database/Record.model.php b/dist/twist/Core/Models/Database/Record.model.php index f963e93c..d426d1aa 100755 --- a/dist/twist/Core/Models/Database/Record.model.php +++ b/dist/twist/Core/Models/Database/Record.model.php @@ -37,11 +37,11 @@ class Record{ /** * Construct the class with all the required data to make usable - * @param $strDatabase - * @param $strTable - * @param $arrStructure - * @param $arrRecord - * @param $blClone + * @param string $strDatabase + * @param string $strTable + * @param array $arrStructure + * @param array $arrRecord + * @param bool $blClone */ public function __construct($strDatabase,$strTable,$arrStructure,$arrRecord,$blClone = false){ $this->strDatabase = $strDatabase; @@ -108,7 +108,7 @@ public function values(){ /** * Get a field value - * @param $strField + * @param string $strField * @return null */ public function get($strField){ @@ -117,22 +117,19 @@ public function get($strField){ /** * Set a single field in the record to a new value, you must call "->save()" to store any changes made to the database - * @param $strField - * @param $strValue + * @param string $strField + * @param string $strValue * @return bool + * @throws \Exception */ public function set($strField,$strValue){ - $blOut = false; - if(array_key_exists($strField,$this->arrStructure['columns'])){ $this->arrRecord[$strField] = $strValue; - $blOut = true; + return true; }else{ throw new \Exception(sprintf("Error adding data to database record, invalid field '%s' passed",$strField)); } - - return $blOut; } /** diff --git a/dist/twist/Core/Models/Database/Records.model.php b/dist/twist/Core/Models/Database/Records.model.php index 05ad7cf0..92f906f7 100644 --- a/dist/twist/Core/Models/Database/Records.model.php +++ b/dist/twist/Core/Models/Database/Records.model.php @@ -43,7 +43,7 @@ public function __setTable($strTable){ /** * Set the database that is being used in the current request if it is different from TWIST_DATABASE_NAME. - * @param string $strTable SQL database name + * @param string $strDatabase SQL database name */ public function __setDatabase($strDatabase){ $this->strDatabase = $strDatabase; @@ -58,7 +58,7 @@ public function create(){ //Get the structure of the table $arrStructure = \Twist::Database()->table($this->strTable,$this->strDatabase)->structure(); - return (is_null($arrStructure)) ? null : new \Twist\Core\Models\Database\Record($this->strDatabase,$this->strTable,$arrStructure,array()); + return (is_null($arrStructure)) ? null : new Record($this->strDatabase,$this->strTable,$arrStructure,array()); } /** @@ -86,7 +86,7 @@ public function get($mxdValue,$strField = 'id',$blReturnArray = false){ if($blReturnArray == false){ //Get the editable database record - $mxdRecord = new \Twist\Core\Models\Database\Record( + $mxdRecord = new Record( $this->strDatabase, $this->strTable, \Twist::Database()->table($this->strTable,$this->strDatabase)->structure(), @@ -122,7 +122,7 @@ public function copy($mxdValue,$strField = 'id'){ $arrRecord[$arrStructure['auto_increment']] = null; } - $resRecord = new \Twist\Core\Models\Database\Record($this->strDatabase,$this->strTable,$arrStructure,$arrRecord,true); + $resRecord = new Record($this->strDatabase,$this->strTable,$arrStructure,$arrRecord,true); } } diff --git a/dist/twist/Core/Models/Database/Table.model.php b/dist/twist/Core/Models/Database/Table.model.php index b975a520..515db518 100644 --- a/dist/twist/Core/Models/Database/Table.model.php +++ b/dist/twist/Core/Models/Database/Table.model.php @@ -42,7 +42,7 @@ public function __setTable($strTable){ /** * Set the database that is being used in the current request if it is different from TWIST_DATABASE_NAME. - * @param string $strTable SQL database name + * @param string $strDatabase SQL database name */ public function __setDatabase($strDatabase){ $this->strDatabase = $strDatabase; @@ -72,7 +72,7 @@ public function exists($blAddTwistPrefix = false){ public function get(){ if($this->exists()){ - return new \Twist\Core\Models\Database\TableStructure($this->strDatabase,$this->strTable,$this->structure()); + return new TableStructure($this->strDatabase,$this->strTable,$this->structure()); } return null; @@ -85,7 +85,7 @@ public function get(){ public function create(){ if(!$this->exists()){ - return new \Twist\Core\Models\Database\TableStructure($this->strDatabase,$this->strTable); + return new TableStructure($this->strDatabase,$this->strTable); } return null; @@ -219,7 +219,7 @@ public function clearStructureCache(){ * Copy an excising table structure into a new object, the new table will not exists until you commit the returned object. * @param string $strNewTable * @param null $strNewDatabase - * @return null|\Twist\Core\Models\Database\Table Returns and object of the database table + * @return null|\Twist\Core\Models\Database\TableStructure Returns and object of the database table */ public function copy($strNewTable,$strNewDatabase = null){ diff --git a/dist/twist/Core/Models/Database/TableStructure.model.php b/dist/twist/Core/Models/Database/TableStructure.model.php index 115cca6e..eac14775 100755 --- a/dist/twist/Core/Models/Database/TableStructure.model.php +++ b/dist/twist/Core/Models/Database/TableStructure.model.php @@ -48,8 +48,9 @@ class TableStructure{ /** * Construct the class with all the required data to make usable - * @param $strDatabase - * @param $strTable + * @param string $strDatabase + * @param string $strTable + * @param array $arrStructure */ public function __construct($strDatabase,$strTable,$arrStructure = array()){ @@ -111,7 +112,8 @@ public function copyTo($strTable,$strDatabase = null){ /** * Set the Collation for the database table, calling this method will also set the charset of the Table accordingly - * @param $strCollation + * @param string $strCollation + * @throws \Exception */ public function collation($strCollation){ @@ -132,7 +134,7 @@ public function collation($strCollation){ /** * Get the Charset for a particular collation - * @param $strCollation + * @param string $strCollation * @return int|null|string */ protected function getCollationCharset($strCollation){ @@ -154,7 +156,7 @@ protected function getCollationCharset($strCollation){ /** * Set the character set for the database table - * @param $strCharset + * @param string $strCharset */ protected function charset($strCharset){ $this->strCharset = $strCharset; @@ -162,7 +164,7 @@ protected function charset($strCharset){ /** * Set the database engine to use for this table - * @param $strEngine + * @param string $strEngine */ public function engine($strEngine){ @@ -172,7 +174,7 @@ public function engine($strEngine){ /** * Set the main Database comment - * @param $strComment + * @param string $strComment */ public function comment($strComment){ @@ -182,7 +184,7 @@ public function comment($strComment){ /** * Set a field to be autoincrement - * @param $strField + * @param string $strField * @param int $intStartNumber * @throws \Exception */ @@ -205,7 +207,8 @@ public function autoIncrement($strField,$intStartNumber = 1){ /** * Set a field to be a primary key - * @param $strField + * @param string $strField + * @param bool $blAutoIncrement * @throws \Exception */ public function primaryKey($strField,$blAutoIncrement = false){ @@ -239,10 +242,9 @@ public function dropPrimaryKey(){ /** * Set a unique key, you can have multiple unique keys per table. To create a unique key from more than 1 field pass the second parameter as an array of fields - * @param $strName - * @param $mxdColumns - * @param $strComment - * @return string + * @param string $strName + * @param mixed $mxdColumns + * @param string $strComment */ public function addUniqueKey($strName,$mxdColumns,$strComment = null){ @@ -257,9 +259,9 @@ public function addUniqueKey($strName,$mxdColumns,$strComment = null){ /** * Set a Index, you can have multiple indexes per table. To create a index from more than 1 field pass the second parameter as an array of fields - * @param $strName - * @param $mxdColumns - * @param $strComment + * @param string $strName + * @param mixed $mxdColumns + * @param string $strComment */ public function addIndex($strName,$mxdColumns,$strComment = null){ @@ -274,7 +276,7 @@ public function addIndex($strName,$mxdColumns,$strComment = null){ /** * Drop a unique key from the table structure - * @param $strName + * @param string $strName */ public function dropUniqueKey($strName){ @@ -289,7 +291,7 @@ public function dropUniqueKey($strName){ /** * Drop a Index from the table structure - * @param $strName + * @param string $strName */ public function dropIndex($strName){ @@ -496,6 +498,7 @@ public function setColumnOrder($strColumnName,$intOrder){ /** * Final call, this will create/alter the tables structure in the database. * @return bool + * @throws \Exception */ public function commit(){ @@ -649,7 +652,7 @@ protected function generateIndexes(){ /** * Generate a partial column SQL that can be used in CREATE and ALTER queries - * @param $arrColumn Array of column data + * @param array $arrColumn Array of column data * @return string Partial Column SQL */ protected function generateColumnSQL($arrColumn){ diff --git a/dist/twist/Core/Models/Debug.model.php b/dist/twist/Core/Models/Debug.model.php index c10580ce..1b1d81b4 100755 --- a/dist/twist/Core/Models/Debug.model.php +++ b/dist/twist/Core/Models/Debug.model.php @@ -39,9 +39,9 @@ public function __construct(){ /** * Log some debug data into the debug array, the debug data is shown on the debug window. - * @param $strSystem - * @param $strType - * @param $mxdData + * @param string $strSystem + * @param string $strType + * @param mixed $mxdData */ public function log($strSystem,$strType,$mxdData){ @@ -58,7 +58,7 @@ public function log($strSystem,$strType,$mxdData){ /** * Process the debug window to be output into the page. - * @param $arrCurrentRoute + * @param array $arrCurrentRoute * @return string */ public function window($arrCurrentRoute){ diff --git a/dist/twist/Core/Models/Email/Create.model.php b/dist/twist/Core/Models/Email/Create.model.php index 164420ee..a11beb76 100644 --- a/dist/twist/Core/Models/Email/Create.model.php +++ b/dist/twist/Core/Models/Email/Create.model.php @@ -108,7 +108,7 @@ public function setCharEncoding($strCharEncoding = 'ISO-8859-1'){ /** * Add the To address for the email, you can add as many To fields as you need. * Optionally you can put the persons full name in the second parameter if you know it. - * @param $strEmailAddress + * @param string $strEmailAddress * @param string $strName */ public function addTo($strEmailAddress,$strName = ''){ @@ -123,7 +123,7 @@ public function addTo($strEmailAddress,$strName = ''){ /** * Add the Cc (Carbon Copy) address for the email, you can add as many Cc fields as you need. * Optionally you can put the persons full name in the second parameter if you know it. - * @param $strEmailAddress + * @param string $strEmailAddress * @param string $strName */ public function addCc($strEmailAddress,$strName = ''){ @@ -139,7 +139,7 @@ public function addCc($strEmailAddress,$strName = ''){ * Add the Bcc (Blind Carbon Copy) address for the email, you can add as many Bcc fields as you need. * Optionally you can put the persons full name in the second parameter if you know it. Note that Bcc will * send a copy of the email to the user but none of the addressed To and Cc users will be aware of this. - * @param $strEmailAddress + * @param string $strEmailAddress * @param string $strName */ public function addBcc($strEmailAddress,$strName = ''){ @@ -154,7 +154,7 @@ public function addBcc($strEmailAddress,$strName = ''){ /** * Set the From email address, this the is the address the email will be sent from. * Optionally you can set a name for the from address in the second parameter. - * @param $strEmailAddress + * @param string $strEmailAddress * @param string $strName */ public function setFrom($strEmailAddress,$strName = ''){ @@ -165,7 +165,7 @@ public function setFrom($strEmailAddress,$strName = ''){ /** * Setup a different reply to address so that when a receiver hits reply in their mail client * the email will be sent to the reply address rather than the from address. - * @param $strEmailAddress + * @param string $strEmailAddress */ public function setReplyTo($strEmailAddress){ $this->arrEmailData['reply_to'] = $strEmailAddress; @@ -174,7 +174,7 @@ public function setReplyTo($strEmailAddress){ /** * Set the subject of the email, this is the brief line of text that a receiver would read in * their client inbox when receiving a new email. - * @param $strSubject + * @param string $strSubject */ public function setSubject($strSubject){ $this->arrEmailData['subject'] = $strSubject; @@ -183,7 +183,7 @@ public function setSubject($strSubject){ /** * Set the plain text body of the email, not required if you have set a HTML body the plain text can be auto * generated. This will happen if no plain text alternative has been entered. - * @param $strBody + * @param string $strBody */ public function setBodyPlain($strBody){ $this->arrEmailData['body_plain'] = $strBody; @@ -192,7 +192,7 @@ public function setBodyPlain($strBody){ /** * Set the HTML body of the email, you can have a plain text only email if required. Full HTML and CSS support, bear in mind that * different mail clients will display HTML in different ways. Testing is key here. - * @param $strBody + * @param string $strBody */ public function setBodyHTML($strBody){ $this->arrEmailData['body_html'] = $strBody; @@ -282,7 +282,7 @@ public function setViewInBrowser(){ /** * Add local (on server) files to be attached to the email ass attachments - * @param $strLocalFile + * @param string $strLocalFile */ public function addAttachment($strLocalFile){ @@ -335,6 +335,7 @@ public function senderValidation(){ * Send the email once all the data ans emails addresses have been added, this by default will user PHP mail unless otherwise specified. * @param bool $blClearCache * @return bool + * @throws \Exception */ public function send($blClearCache = true){ @@ -458,7 +459,7 @@ protected function sanitisePlainMessage(){ /** * Remove all the style tags, html tags and then decode any HTML entities - * @param $strHtmlContent + * @param string $strHtmlContent * @return mixed */ protected function stripTags($strHtmlContent){ @@ -476,7 +477,7 @@ protected function generateHTMLMessage(){ /** * Convert the header encoding, if no multibyte support on PHP installation ignore the encoding and output a warning - * @param $strData + * @param string $strData * @return string */ protected function convertEncodingHeader($strData){ @@ -492,7 +493,7 @@ protected function convertEncodingHeader($strData){ /** * Convert the body encoding, if no multibyte support on PHP installation ignore the encoding and output a warning - * @param $strData + * @param string $strData * @return string */ protected function convertEncodingBody($strData){ @@ -612,7 +613,7 @@ protected function encodeMultipartMessage(){ /** * Set all the required attachment headers for each attachment. - * @param $strBoundary + * @param string $strBoundary * @return string */ protected function attachmentHeaders($strBoundary){ diff --git a/dist/twist/Core/Models/Email/ProtocolNative.model.php b/dist/twist/Core/Models/Email/ProtocolNative.model.php index db5f7a5a..312e7946 100755 --- a/dist/twist/Core/Models/Email/ProtocolNative.model.php +++ b/dist/twist/Core/Models/Email/ProtocolNative.model.php @@ -36,17 +36,21 @@ class ProtocolNative{ protected $strBody = null; protected $blUseFromParameter = false; - public function setTimeout($intTimeout = 90){ return true; } + public function setTimeout($intTimeout = 90){ //TODO: $intTimeout not used + return true; + } public function getLastMessage(){ return ''; } - public function connect($strHost,$intPort = 25){ return true; } + public function connect($strHost,$intPort = 25){ //TODO: $strHost and $intPort not used + return true; + } public function connected(){ return $this->blConnected; } public function disconnect(){} - public function login($strEmailAddress,$strPassword){ + public function login($strEmailAddress,$strPassword){ //TODO: $strEmailAddress and $strPassword not used return true; } diff --git a/dist/twist/Core/Models/Email/ProtocolSMTP.model.php b/dist/twist/Core/Models/Email/ProtocolSMTP.model.php index ed17aea6..ef0b8212 100755 --- a/dist/twist/Core/Models/Email/ProtocolSMTP.model.php +++ b/dist/twist/Core/Models/Email/ProtocolSMTP.model.php @@ -42,8 +42,8 @@ public function getLastMessage(){ /** * Open a new FTP connection - * @param $strHost - * @param $intPort + * @param string $strHost + * @param integer $intPort * @throws RuntimeException */ public function connect($strHost,$intPort = 25){ diff --git a/dist/twist/Core/Models/Email/SourceParser.model.php b/dist/twist/Core/Models/Email/SourceParser.model.php index 8135d189..87056765 100644 --- a/dist/twist/Core/Models/Email/SourceParser.model.php +++ b/dist/twist/Core/Models/Email/SourceParser.model.php @@ -34,7 +34,7 @@ class SourceParser{ /** * Pass in the full raw source of an email and it will parse and return as a simple usable array of data. - * @param $strEmailSource + * @param string $strEmailSource * @return array */ public function processEmailSource($strEmailSource){ @@ -68,7 +68,7 @@ public function processEmailSource($strEmailSource){ /** * Parse the decoded boundaries, turn them into a usable data - * @param $arrBoundaries + * @param array $arrBoundaries * @param bool $blReturnLog * @return array */ @@ -110,7 +110,7 @@ protected function parseBoundaries($arrBoundaries,$blReturnLog = true){ /** * Split the email source into a multi-dimensional array by boundary ID - * @param $strData + * @param string $strData * @param string $strBoundary * @return array */ @@ -182,7 +182,7 @@ protected function splitBoundaries($strData,$strBoundary = ''){ /** * Decode QPrint helps with decoding emails from the system - * @param $str + * @param string $strData * @return string */ protected function decodeQuotedPrintable($strData){ @@ -192,14 +192,14 @@ protected function decodeQuotedPrintable($strData){ /** * Strip out all unwanted headers from email raw source - * @param $strEmailSource + * @param string $strEmailSource * @return mixed */ protected function stripEmailHeaders($strEmailSource){ $arrParts = explode("\n\n",$strEmailSource); - $strHeaders = $arrParts[0]; + $strHeaders = $arrParts[0]; //TODO: Remove? $arrParts[0] = null; $strEmailSource = implode("\n\n",$arrParts); diff --git a/dist/twist/Core/Models/FTP/Native.model.php b/dist/twist/Core/Models/FTP/Native.model.php index 7ccd5e76..6055777a 100755 --- a/dist/twist/Core/Models/FTP/Native.model.php +++ b/dist/twist/Core/Models/FTP/Native.model.php @@ -36,9 +36,8 @@ public function setTimeout($intTimeout = null){ /** * Open a new FTP connection - * @param $strHost - * @param $intPort - * @throws RuntimeException + * @param string $strHost + * @param integer $intPort */ public function connect($strHost,$intPort = 21){ $this->resConnection = ftp_connect($strHost,$intPort,$this->intTimeout); @@ -53,8 +52,8 @@ public function disconnect(){ /** * Login to the open FTP connection - * @param $strUsername - * @param $strPassword + * @param string $strUsername + * @param string $strPassword * @return bool */ public function login($strUsername,$strPassword){ @@ -76,10 +75,12 @@ public function systype(){ /** * Get an array of supported features for the current FTP server connection - * @return array|bool + * @return array */ public function feat(){ + $mxdOut = array(); + //Custom built as dosnt appear to be a natively supported command $strResponse = ftp_raw($this->resConnection,"FEAT"); @@ -91,18 +92,19 @@ public function feat(){ array_shift($arrLines); if(count($arrLines)){ - $mxdOut = array(); foreach($arrLines as $strEachLine){ $arrParts = explode(' ',$strEachLine); $mxdOut[$arrParts[0]] = $strEachLine; } } } + + return $mxdOut; } /** * Make Directory - * @param $strDirectory + * @param string $strDirectory * @return bool */ public function mkd($strDirectory){ @@ -111,7 +113,7 @@ public function mkd($strDirectory){ /** * Remove Directory - * @param $strDirectory + * @param string $strDirectory * @return bool */ public function rmd($strDirectory){ @@ -128,7 +130,7 @@ public function pwd(){ /** * Change working directory - * @param $strDirectory + * @param string $strDirectory * @return bool */ public function cwd($strDirectory){ @@ -137,8 +139,8 @@ public function cwd($strDirectory){ /** * Rename a directory or file to a new name - * @param $strFilename - * @param $strNewFilename + * @param string $strFilename + * @param string $strNewFilename * @return bool */ public function rename($strFilename, $strNewFilename){ @@ -147,7 +149,7 @@ public function rename($strFilename, $strNewFilename){ /** * Remove the file from the server - * @param $strFilename + * @param string $strFilename * @return bool */ public function delete($strFilename){ @@ -156,8 +158,8 @@ public function delete($strFilename){ /** * CHMOD the files permissions - * @param $strFilename - * @param $intMode + * @param string $strFilename + * @param integer $intMode * @return bool */ public function chmod($strFilename,$intMode){ @@ -166,8 +168,8 @@ public function chmod($strFilename,$intMode){ /** * Download a file from the remote FTP server - * @param $strRemoteFilename - * @param $strLocalFilename + * @param string $strRemoteFilename + * @param string $strLocalFilename * @param string $strMode * @return bool */ @@ -178,8 +180,8 @@ public function download($strRemoteFilename, $strLocalFilename, $strMode = 'A'){ /** * Upload a file to the remote FTP server - * @param $strLocalFilename - * @param $strRemoteFilename + * @param string $strLocalFilename + * @param string $strRemoteFilename * @param string $strMode * @return bool */ @@ -190,7 +192,7 @@ public function upload($strLocalFilename, $strRemoteFilename, $strMode = 'A'){ /** * List the provided directory and return as an array - * @param $strDirectory + * @param string $strDirectory * @return array|bool */ public function nlist($strDirectory){ @@ -199,7 +201,7 @@ public function nlist($strDirectory){ /** * Get the size of any given file on the remote FTP server - * @param $strFilename + * @param string $strFilename * @return bool|int */ public function size($strFilename){ @@ -208,7 +210,7 @@ public function size($strFilename){ /** * Get the last modified time of any given file on the remote FTP server - * @param $strFilename + * @param string $strFilename * @return bool|int */ public function mdtm($strFilename){ diff --git a/dist/twist/Core/Models/FTP/Socket.model.php b/dist/twist/Core/Models/FTP/Socket.model.php index 5a9c770a..0a177059 100755 --- a/dist/twist/Core/Models/FTP/Socket.model.php +++ b/dist/twist/Core/Models/FTP/Socket.model.php @@ -37,9 +37,9 @@ public function setTimeout($intTimeout = 90){ /** * Open a new FTP connection - * @param $strHost - * @param $intPort - * @throws RuntimeException + * @param string $strHost + * @param integer $intPort + * @throws \Exception */ public function connect($strHost,$intPort){ @@ -72,8 +72,8 @@ public function disconnect(){ /** * Login to the open FTP connection - * @param $strUsername - * @param $strPassword + * @param string $strUsername + * @param string $strPassword * @return bool */ public function login($strUsername,$strPassword){ @@ -129,7 +129,7 @@ public function feat(){ /** * Make Directory - * @param $strDirectory + * @param string $strDirectory * @return bool */ public function mkd($strDirectory){ @@ -138,7 +138,7 @@ public function mkd($strDirectory){ /** * Remove Directory - * @param $strDirectory + * @param string $strDirectory * @return bool */ public function rmd($strDirectory){ @@ -163,7 +163,7 @@ public function pwd(){ /** * Change working directory - * @param $strDirectory + * @param string $strDirectory * @return bool */ public function cwd($strDirectory){ @@ -172,8 +172,8 @@ public function cwd($strDirectory){ /** * Rename a directory or file to a new name - * @param $strFilename - * @param $strNewFilename + * @param string $strFilename + * @param string $strNewFilename * @return bool */ public function rename($strFilename, $strNewFilename){ @@ -182,7 +182,7 @@ public function rename($strFilename, $strNewFilename){ /** * Remove the file from the server - * @param $strFilename + * @param string $strFilename * @return bool */ public function delete($strFilename){ @@ -191,8 +191,8 @@ public function delete($strFilename){ /** * CHMOD the files permissions - * @param $strFilename - * @param $intMode + * @param string $strFilename + * @param integer $intMode * @return bool */ public function chmod($strFilename, $intMode){ @@ -201,8 +201,8 @@ public function chmod($strFilename, $intMode){ /** * Download a file from the remote FTP server - * @param $strRemoteFilename - * @param $strLocalFilename + * @param string $strRemoteFilename + * @param string $strLocalFilename * @param string $strMode * @return bool */ @@ -245,8 +245,8 @@ public function download($strRemoteFilename, $strLocalFilename, $strMode = 'A'){ /** * Upload a file to the remote FTP server - * @param $strLocalFilename - * @param $strRemoteFilename + * @param string $strLocalFilename + * @param string $strRemoteFilename * @param string $strMode * @return bool */ @@ -279,7 +279,7 @@ public function upload($strLocalFilename, $strRemoteFilename, $strMode = 'A'){ /** * List the provided directory and return as an array - * @param $strDirectory + * @param string $strDirectory * @return array|bool */ public function nlist($strDirectory){ @@ -303,7 +303,7 @@ public function nlist($strDirectory){ /** * Get the size of any given file on the remote FTP server - * @param $strFilename + * @param string $strFilename * @return bool|int */ public function size($strFilename){ @@ -322,7 +322,7 @@ public function size($strFilename){ /** * Get the last modified time of any given file on the remote FTP server - * @param $strFilename + * @param string $strFilename * @return bool|int */ public function getModifiedDateTime($strFilename){ diff --git a/dist/twist/Core/Models/Form/Builder.model.php b/dist/twist/Core/Models/Form/Builder.model.php index b611d541..0ba37ea5 100755 --- a/dist/twist/Core/Models/Form/Builder.model.php +++ b/dist/twist/Core/Models/Form/Builder.model.php @@ -76,13 +76,11 @@ public function addGroupField($mxdGroupID,$strTitle,$strName,$strType,$intMaxLen $this->storeField($strTitle,$strName,$strType,$intMaxLength,$mxdValue,$arrAttributes,$mxdGroupID); } - public function requiredFields(){ - //@todo Speak to andi about if this should be a multi or single param + public function requiredFields(){ //TODO: Speak to Andi about if this should be a multi or single param //return $this->updateField($strName,'required',1); } - public function requiredGroups(){ - //@todo Speak to andi about if this should be a multi or single param + public function requiredGroups(){ //TODO: Speak to Andi about if this should be a multi or single param //return $this->updateGroup($strName,'required',1); } @@ -102,8 +100,7 @@ public function addCancel($strName,$strCancelRedirect){ $this->arrDetails['cancel'] = array('name' => $strName,'redirect' => $strCancelRedirect); } - public function saveSubmissions(){ - //@todo Save in a database table + public function saveSubmissions(){ //TODO: Save in a database table } public function render(){ @@ -111,7 +108,7 @@ public function render(){ $this->processSubmissionData(); //https://gist.github.com/ahosgood/88d474c0b811ce469bc0 - //@todo store cache of the form, build in option to put in custom tags to allow cache form to be populated with data and pre-selects where required + //TODO: Store cache of the form, build in option to put in custom tags to allow cache form to be populated with data and pre-selects where required $resTemplate = \Twist::View('pkgForm'); $resTemplate->setDirectory(sprintf('%s/form/',TWIST_FRAMEWORK_VIEWS)); @@ -180,7 +177,7 @@ public function render(){ } } - //@todo look at buttons as the submit should always be present + //TODO: Look at buttons as the submit should always be present if(!is_null($this->arrDetails['submit'])){ $arrFormTags['fields'] .= $resTemplate->build('button.tpl',$this->arrDetails['submit']).self::EOL; } diff --git a/dist/twist/Core/Models/Hooks.model.php b/dist/twist/Core/Models/Hooks.model.php index 77c4664a..5b356cee 100755 --- a/dist/twist/Core/Models/Hooks.model.php +++ b/dist/twist/Core/Models/Hooks.model.php @@ -84,10 +84,10 @@ public function __construct(){ /** * Register a hook to extend framework or package functionality - * @param $strHook - * @param $mxdUniqueKey - * @param $mxdData - * @param $blPermanent + * @param string $strHook + * @param mixed $mxdUniqueKey + * @param mixed $mxdData + * @param bool $blPermanent */ public function register($strHook,$mxdUniqueKey,$mxdData,$blPermanent = false){ @@ -104,9 +104,9 @@ public function register($strHook,$mxdUniqueKey,$mxdData,$blPermanent = false){ /** * Cancel a hook from being active in the system, this will cancel the hook form the current page load only - * @param $strHook - * @param $mxdUniqueKey - * @param $blPermanent + * @param string $strHook + * @param mixed $mxdUniqueKey + * @param bool $blPermanent */ public function cancel($strHook,$mxdUniqueKey,$blPermanent = false){ @@ -119,8 +119,8 @@ public function cancel($strHook,$mxdUniqueKey,$blPermanent = false){ /** * Get the array of extensions for the requested hook and key - * @param $strHook - * @param $mxdUniqueKey + * @param string $strHook + * @param mixed $mxdUniqueKey * @return array */ public function get($strHook,$mxdUniqueKey){ @@ -129,7 +129,7 @@ public function get($strHook,$mxdUniqueKey){ /** * Get all the hooks, you can filter by package or leave blank for everything - * @param $strHook + * @param string $strHook * @return array */ public function getAll($strHook = null){ @@ -177,9 +177,9 @@ protected function loadHooks(){ /** * Permanently store a new hook - * @param $strHook - * @param $mxdUniqueKey - * @param $mxdData + * @param string $strHook + * @param mixed $mxdUniqueKey + * @param mixed $mxdData */ protected function storeHook($strHook,$mxdUniqueKey,$mxdData){ @@ -204,8 +204,8 @@ protected function storeHook($strHook,$mxdUniqueKey,$mxdData){ /** * Remove a permanently stored hook, only wo - * @param $strHook - * @param $mxdUniqueKey + * @param string $strHook + * @param mixed $mxdUniqueKey */ protected function removeHook($strHook,$mxdUniqueKey){ diff --git a/dist/twist/Core/Models/ICS/Calendar.model.php b/dist/twist/Core/Models/ICS/Calendar.model.php index b3b07996..0a12c004 100755 --- a/dist/twist/Core/Models/ICS/Calendar.model.php +++ b/dist/twist/Core/Models/ICS/Calendar.model.php @@ -131,7 +131,7 @@ public function event($intUID = null){ } if(is_null($intUID)){ - $resEvent = new ICSEvent(); + $resEvent = new ICSEvent(); //TODO: Where? $this->arrEvents[$resEvent->uid()] = $resEvent; }else{ $resEvent = $this->arrEvents[$intUID]; @@ -188,6 +188,9 @@ public function setData($strKey,$mxdData){ $this->arrData[strtoupper(trim($strKey))] = $this->sanitizeRawData($mxdData); } + /** + * @param string $strFileName + */ public function serve($strFileName = 'calendar'){ $strFileName = \Twist::File()->sanitizeName($strFileName); diff --git a/dist/twist/Core/Models/Image/Image.model.php b/dist/twist/Core/Models/Image/Image.model.php index 972f2c8a..25e79301 100755 --- a/dist/twist/Core/Models/Image/Image.model.php +++ b/dist/twist/Core/Models/Image/Image.model.php @@ -125,8 +125,8 @@ protected function create($intWidth,$intHeight,$strFillColour = null){ /** * Save the image as a file, the format will be determined by the file extension. Leaving the file name as null will use the original filename. - * @param $strFilename If omitted the original file will be overwritten - * @param $intQuality Output image quality in percents 0-100 + * @param string $strFilename If omitted the original file will be overwritten + * @param integer $intQuality Output image quality in percents 0-100 * @return $this * @throws \Exception */ @@ -161,10 +161,10 @@ public function save($strFilename=null,$intQuality=null){ /** * Outputs the image to the screen without saving - * @param $strFormat If omitted or null - format of original file will be used, may be gif|jpg|png - * @param $intQuality Output image quality in percents 0-100 - * @param $intCache set the life of the image so that the browser can cache it, defaults to 3600 seconds, set to null for no caching - * @param $blGZip Output the image compressed with gzip, this will only happen if set to true and the browser accepts gzip encoding + * @param string $strFormat If omitted or null - format of original file will be used, may be gif|jpg|png + * @param integer $intQuality Output image quality in percents 0-100 + * @param integer $intCache set the life of the image so that the browser can cache it, defaults to 3600 seconds, set to null for no caching + * @param bool $blGZip Output the image compressed with gzip, this will only happen if set to true and the browser accepts gzip encoding * @throws \Exception */ public function output($strFormat=null,$intQuality=null,$intCache=3600,$blGZip=true){ @@ -193,8 +193,8 @@ public function output($strFormat=null,$intQuality=null,$intCache=3600,$blGZip=t /** * Outputs the image as a Base64 encoded string - * @param $strFormat If omitted or null - format of original file will be used, may be gif|jpg|png - * @param $intQuality Output image quality in percents 0-100 + * @param string $strFormat If omitted or null - format of original file will be used, may be gif|jpg|png + * @param integer $intQuality Output image quality in percents 0-100 * @return string */ public function outputBase64($strFormat=null,$intQuality=null){ @@ -205,8 +205,8 @@ public function outputBase64($strFormat=null,$intQuality=null){ /** * Get the raw data of an image that can be output as a file, served to the screen or transformed into a base64 string - * @param $strFormat - * @param $intQuality + * @param string$strFormat + * @param integer $intQuality * @return array * @throws \Exception */ @@ -246,8 +246,8 @@ protected function outputRaw($strFormat=null,$intQuality=null){ /** * Get the aspect ratio of an image from its width and height - * @param $intWidth - * @param $intHeight + * @param integer $intWidth + * @param integer $intHeight * @return float */ protected function aspectRatio($intWidth,$intHeight){ @@ -275,7 +275,7 @@ protected function detectOrientation(){ /** * Converts a hex color value to its RGB equivalent, you can pass in a Hex color string, array(red, green, blue) or array(red, green, blue, alpha). * Red,Green,Blue must be integers between 0-255 and Alpha must be an integer between 0-127 - * @param $mxdColour + * @param mixed $mxdColour * @return array|bool */ protected function normalizeColor($mxdColour){ @@ -321,9 +321,9 @@ protected function normalizeColor($mxdColour){ /** * Ensures $intInteger is always within $intMinValue and $intMaxValue range. If $intInteger is lower than $intMinValue, $intMinValue is returned. If $intInteger is higher than $intMaxValue, $intMaxValue is returned. - * @param $intInteger - * @param $intMinValue - * @param $intMaxValue + * @param integer $intInteger + * @param integer $intMinValue + * @param integer $intMaxValue * @return mixed */ protected function keepWithinRange($intInteger,$intMinValue,$intMaxValue){ @@ -347,10 +347,10 @@ public function fill($strFillColour='#000000'){ /** * Draw a line on the image, you have the option of setting the width of the line. The line can be drawn at any angle - * @param $intStartX - * @param $intStartY - * @param $intEndX - * @param $intEndY + * @param integer $intStartX + * @param integer $intStartY + * @param integer $intEndX + * @param integer $intEndY * @param string $strFillColour * @param int $intWidth * @return bool @@ -388,10 +388,10 @@ public function line($intStartX,$intStartY,$intEndX,$intEndY,$strFillColour='#00 /** * Draw a rectangle on the image - * @param $intStartX - * @param $intStartY - * @param $intEndX - * @param $intEndY + * @param integer $intStartX + * @param integer $intStartY + * @param integer $intEndX + * @param integer $intEndY * @param string $strFillColour * @return bool */ @@ -405,7 +405,7 @@ public function rectangle($intStartX,$intStartY,$intEndX,$intEndY,$strFillColour /** * Draw a polygon on the image - * @param $arrPoints + * @param array $arrPoints * @param string $strFillColour * @param null $intPointsCount */ @@ -421,9 +421,9 @@ public function polygon($arrPoints,$intPointsCount,$strFillColour='#000000'){ /** * Add a string to the image as a watermark or caption - * @param $intStartX - * @param $intStartY - * @param $strString + * @param integer $intStartX + * @param integer $intStartY + * @param string $strString * @param string $strFillColour */ public function string($intStartX,$intStartY,$strString,$strFillColour='#000000'){ @@ -477,13 +477,13 @@ public function opacity($intOpacity){ imagesavealpha($resTempImage, true); imagecopy($resTempImage, $this->resImage, 0, 0, 0, 0, $this->intWidth, $this->intHeight); - //@todo need to look into as this will wipe all original data + //TODO: Need to look into as this will wipe all original data // Create transparent layer $this->create($this->intWidth, $this->intHeight, array(0, 0, 0, 127)); // Merge with specified opacity - $this->imagecopymerge_alpha($this->resImage, $resTempImage, 0, 0, 0, 0, $this->intWidth, $this->intHeight, $this->keepWithinRange($intOpacity, 0, 1) * 100); + $this->imagecopymerge_alpha($this->resImage, $resTempImage, 0, 0, 0, 0, $this->intWidth, $this->intHeight, $this->keepWithinRange($intOpacity, 0, 1) * 100); //TODO: Where is imagecopymerge_alpha? imagedestroy($resTempImage); return $this; @@ -521,10 +521,11 @@ public function rotate($mxdAngle, $mxdBackgroundColour = '#000000'){ /** * Crop the image with the following left, top, right, bottom coordinates - * @param int $intX1 Left - * @param int $intY1 Top - * @param int $intX2 Right - * @param int $intY2 Bottom + * @param integer $intX1 Left + * @param integer $intY1 Top + * @param integer $intX2 Right + * @param integer $intY2 Bottom + * @return $this */ public function crop($intX1, $intY1, $intX2, $intY2){ @@ -552,6 +553,7 @@ public function crop($intX1, $intY1, $intX2, $intY2){ /** * Proportionally resize to a specified width (scales up and down the image as required) * @param int $intWidth + * @return Image */ public function resizeWidth($intWidth){ $intHeight = $intWidth * $this->aspectRatio($this->intWidth,$this->intHeight); @@ -561,6 +563,7 @@ public function resizeWidth($intWidth){ /** * Proportionally resize the image to a specified height (scales up and down the image as required) * @param int $intHeight + * @return Image */ public function resizeHeight($intHeight){ $intWidth = $intHeight / $this->aspectRatio($this->intWidth,$this->intHeight); @@ -595,6 +598,7 @@ public function resizeMaxDimension($intMaxDimension){ * Resize the image to specified dimensions provided in the width and height parameters * @param int $intWidth * @param int $intHeight + * @return $this */ public function resize($intWidth, $intHeight){ @@ -630,7 +634,7 @@ public function resize($intWidth, $intHeight){ /** * Get the image to as close to the provided dimensions as possible, and then crops the remaining overflow (from the center) to get the image to be the size specified. Useful for generating thumbnails. - * @param $intWidth + * @param integer $intWidth * @param null $intHeight (If omitted, assumed to be equal to $intWidth) * @return mixed */ @@ -658,8 +662,9 @@ public function resizeCover($intWidth, $intHeight = null){ /** * Keeping the same aspect ratio as the original, contain the image within the width and height provided, any white space will be filled with the fill colour - * @param $intMaxWidth - * @param $intMaxHeight + * @param integer $intContainerWidth + * @param integer $intContainerHeight + * @param string $strFillColour * @return $this */ public function resizeContain($intContainerWidth, $intContainerHeight,$strFillColour = '#000000'){ @@ -741,6 +746,7 @@ public function antialias(){ * Apply a Blur effect to the image, select the type of blur that is required and set the number of passes to make, defaults to 1 * @param string $strType selective|gaussian * @param int $intTotalPasses + * @return $this */ public function filterBlur($strType = 'selective', $intTotalPasses = 1) { for($intPass = 0; $intPass < $intTotalPasses; $intPass++){ @@ -752,6 +758,7 @@ public function filterBlur($strType = 'selective', $intTotalPasses = 1) { /** * Apply a Brightness effect to the image, a level can be passed in for the required level of brightness between -255 and 255. Defaults to 0 * @param int $intLevel + * @return $this */ public function filterBrightness($intLevel = 0){ imagefilter($this->resImage, IMG_FILTER_BRIGHTNESS, $this->keepWithinRange($intLevel, -255, 255)); @@ -760,8 +767,9 @@ public function filterBrightness($intLevel = 0){ /** * Apply a Colorize effect to the image, the image will be colorized according the the HEX colour value and opacity 0.0 - 1.0 value - * @param $strColour + * @param string $strColour * @param int $fltOpacity + * @return $this */ public function filterColorize($strColour, $fltOpacity = 0) { $arrRGBA = $this->normalizeColor($strColour); @@ -773,6 +781,7 @@ public function filterColorize($strColour, $fltOpacity = 0) { /** * Apply a Contrast effect to the image, a level can be passed in for the required level of contrast between -100 and 100. Defaults to 0 * @param int $intLevel + * @return $this */ public function filterContrast($intLevel = 0){ imagefilter($this->resImage, IMG_FILTER_CONTRAST, $this->keepWithinRange($intLevel, -100, 100)); @@ -823,6 +832,7 @@ public function filterMeanRemoval(){ /** * Apply a Pixalate effect to the image, pass in the pixel block size. The image will be made of of pixel blocks of the given size. * @param int $intBlockPixelSize + * @return $this */ public function filterPixelate($intBlockPixelSize = 10){ imagefilter($this->resImage, IMG_FILTER_PIXELATE, $intBlockPixelSize, true); @@ -849,6 +859,7 @@ public function filterSketch(){ /** * Apply a Smooth effect to the image, a level can be passed in for the required level of smoothing between -10 and 10. Defaults to 0 * @param int $intLevel + * @return $this */ public function smooth($intLevel = 0){ imagefilter($this->resImage, IMG_FILTER_SMOOTH, $this->keepWithinRange($intLevel, -10, 10)); diff --git a/dist/twist/Core/Models/Install.model.php b/dist/twist/Core/Models/Install.model.php index 466d9b2e..57517ce1 100755 --- a/dist/twist/Core/Models/Install.model.php +++ b/dist/twist/Core/Models/Install.model.php @@ -31,7 +31,7 @@ class Install{ /** * Install/Configure the framework, this is required before the framework will function - * @param $arrConfiguration + * @param array $arrConfiguration * @return string */ public static function framework($arrConfiguration){ @@ -174,7 +174,7 @@ public static function secureAppFolder($dirAppFolder){ /** * Install a package, this is required before a package can be run by the framework - * @param $dirPackageJSON + * @param string $dirPackageJSON * @return bool|int|null */ public static function package($dirPackageJSON){ @@ -213,7 +213,7 @@ public static function package($dirPackageJSON){ /** * Remove a package, un-registers it from the framework - * @param $strPackageSlug + * @param string $strPackageSlug * @return null */ public static function removePackage($strPackageSlug){ @@ -223,7 +223,7 @@ public static function removePackage($strPackageSlug){ /** * Install any DB and tables required by the framework - * @param $dirInstallSQL + * @param string $dirInstallSQL */ public static function importSQL($dirInstallSQL){ @@ -258,7 +258,7 @@ public static function importSQL($dirInstallSQL){ /** * Install any framework settings that are required by the core. - * @param $dirSettingsJSON + * @param string $dirSettingsJSON * @throws \Exception */ public static function importSettings($dirSettingsJSON){ @@ -289,11 +289,11 @@ public static function importSettings($dirSettingsJSON){ /** * Remove settings from the framework, these settings can be package or code settings - * @param $strSlug - * @param $strType + * @param string $strSlug + * @param string $strType * @param null $strKey to remove a single settings only pass its key */ - public static function removeSettings($strSlug,$strType,$strKey = null){ + public static function removeSettings($strSlug,$strType,$strKey = null){ //TODO: $strKey not used \Twist::framework()->settings()->uninstall($strSlug,$strType); } } \ No newline at end of file diff --git a/dist/twist/Core/Models/Package.model.php b/dist/twist/Core/Models/Package.model.php index 72be93b4..808f5d79 100755 --- a/dist/twist/Core/Models/Package.model.php +++ b/dist/twist/Core/Models/Package.model.php @@ -101,6 +101,7 @@ public function getUninstalled(){ /** * Get an array of all the installed packages on the system + * @param bool $blRebuild * @return array|bool */ public function getInstalled($blRebuild = false){ @@ -188,8 +189,8 @@ public function anonymousStats($strType = 'stats',$strSlug = null,$mxdVersion = /** * Load the package into the framework for us - * @param $strSlug - * @param $arrPackageData + * @param string $strSlug + * @param array $arrPackageData */ protected function load($strSlug,$arrPackageData){ @@ -224,7 +225,7 @@ protected function load($strSlug,$arrPackageData){ /** * Find the uninstalled package by its slug and run the install.php file within the package folder. - * @param $strInstallSlug + * @param string $strInstallSlug * @return bool */ public function installer($strInstallSlug){ @@ -267,7 +268,7 @@ public function install(){ /** * Install any DB and tables required by the package, this function is called by the packages install.php file located in the package folder. - * @param $dirInstallSQL + * @param string $dirInstallSQL */ public function importSQL($dirInstallSQL){ @@ -286,7 +287,7 @@ public function importSQL($dirInstallSQL){ /** * Install any framework settings that are required by the package, this function is called by the packages install.php file located in the package folder. - * @param $dirSettingsJSON + * @param string $dirSettingsJSON * @throws \Exception */ public function importSettings($dirSettingsJSON){ @@ -296,7 +297,7 @@ public function importSettings($dirSettingsJSON){ $dirInstallFile = $arrBacktrace[0]['file']; $dirPackage = dirname($dirInstallFile); - $strSlug = strtolower(basename($dirPackage)); + $strSlug = strtolower(basename($dirPackage)); //TODO: Remove? //Install the SQL tables when required $dirSettingsJSON = (!file_exists($dirSettingsJSON)) ? sprintf('%s/%s', $dirPackage, $dirSettingsJSON) : $dirSettingsJSON; @@ -323,15 +324,15 @@ public function removeSettings(){ /** * Find the installed package by its slug and run the uninstall.php file within the package folder. - * @param $strInstallSlug + * @param string $strUninstallSlug * @return bool */ - public function uninstaller($strUnInstallSlug){ + public function uninstaller($strUninstallSlug){ $blOut = false; foreach($this->getInstalled() as $strSlug => $arrEachPackage){ - if($strUnInstallSlug === $strSlug){ + if($strUninstallSlug === $strSlug){ include sprintf('%s/%s/uninstall.php',TWIST_PACKAGES,$arrEachPackage['folder']); $blOut = true; break; @@ -361,7 +362,7 @@ public function uninstall(){ /** * Check to see if a package is installed on the framework by its package slug (lowercase package folder name) - * @param $strPackageSlug + * @param string $strPackageSlug * @return bool */ public function isInstalled($strPackageSlug){ @@ -370,9 +371,10 @@ public function isInstalled($strPackageSlug){ /** * Check to see that a package is installed and usable, optional throw an exception of the package dosnt exist - * @param $strPackage - * @param $blThrowException + * @param string $strPackageSlug + * @param bool $blThrowException * @return bool + * @throws \Exception */ public function exists($strPackageSlug,$blThrowException = false){ @@ -387,7 +389,7 @@ public function exists($strPackageSlug,$blThrowException = false){ /** * Get the details of an installed package and return them as an array - * @param $strPackageSlug + * @param string $strPackageSlug * @return array */ public function get($strPackageSlug){ @@ -397,7 +399,7 @@ public function get($strPackageSlug){ /** * Get the details of a local/installed package and return them as an array - * @param $strPackageKey + * @param string $strPackageKey * @return array */ public function getByKey($strPackageKey){ @@ -413,7 +415,7 @@ public function getByKey($strPackageKey){ /** * Get all the current information for any installed package - * @param $strPackage + * @param string $strPackage * @return array */ public function information($strPackage){ @@ -425,7 +427,9 @@ public function information($strPackage){ /** * Load the interface that comes as part of a package - * @param $strPackage + * @param string $strPackageRoute + * @param string $strRegisteredURI + * @param mixed $mxdBaseView * @throws \Exception */ public function route($strPackageRoute,$strRegisteredURI,$mxdBaseView){ diff --git a/dist/twist/Core/Models/Register.model.php b/dist/twist/Core/Models/Register.model.php index 3c1af0a0..9ad2a04f 100755 --- a/dist/twist/Core/Models/Register.model.php +++ b/dist/twist/Core/Models/Register.model.php @@ -32,9 +32,9 @@ class Register{ /** * Register a handler for shutdown events, errors and exceptions. All default handlers are registered with this method by TwistPHP. - * @param $strType - * @param $strClass - * @param $strFunction + * @param string $strType + * @param string $strClass + * @param string $strFunction * @param null $strEventKey */ public function handler($strType,$strClass,$strFunction,$strEventKey = null){ @@ -61,7 +61,7 @@ public function handler($strType,$strClass,$strFunction,$strEventKey = null){ /** * Cancel a registered handler, these handlers can be for shutdown events, errors and exceptions. - * @param $strType + * @param string $strType * @param null $strEventKey */ public function cancelHandler($strType,$strEventKey = null){ @@ -89,9 +89,9 @@ public function cancelHandler($strType,$strEventKey = null){ /** * Alias function with the first parameter preset to 'shutdown'. * @alias handler - * @param $strEventKey - * @param $strClass - * @param $strFunction + * @param string $strEventKey + * @param string $strClass + * @param string $strFunction */ public function shutdownEvent($strEventKey,$strClass,$strFunction){ $this->handler('shutdown',$strClass,$strFunction,$strEventKey); @@ -100,7 +100,7 @@ public function shutdownEvent($strEventKey,$strClass,$strFunction){ /** * Alias function with the first parameter preset to 'shutdown'. * @alias cancelHandler - * @param $strEventKey + * @param string $strEventKey */ public function cancelShutdownEvent($strEventKey){ $this->cancelHandler('shutdown',$strEventKey); diff --git a/dist/twist/Core/Models/Resources.model.php b/dist/twist/Core/Models/Resources.model.php index e1f5a2e8..e820f6b0 100755 --- a/dist/twist/Core/Models/Resources.model.php +++ b/dist/twist/Core/Models/Resources.model.php @@ -48,7 +48,8 @@ class Resources{ * * An example of the tag with all the above parameters in use {resource:jquery,inline=1,async=async,version=2.0.0} * - * @param $strReference + * @param string $strReference + * @param array $arrParameters * @return string Processed HTML output for the resource view tag */ public function viewResource($strReference,$arrParameters = array()){ @@ -125,7 +126,7 @@ public function viewResource($strReference,$arrParameters = array()){ * Define the type of asynchronously loading, the choice of async or defer can be optionally set. * * An example of the tag with all the above parameters in use {css:packages/Lavish/Resources/css/base.css,inline=1,async=async} - * @param $strReference + * @param string $strReference * @param array $arrParameters * @return string Processed HTML output for the CSS view tag */ @@ -163,7 +164,7 @@ public function viewCSS($strReference,$arrParameters = array()){ * Define the type of asynchronously loading, the choice of async or defer can be optionally set. * * An example of the tag with all the above parameters in use {js:packages/Lavish/Resources/js/base.js,inline=1,async=async} - * @param $strReference + * @param string $strReference * @param array $arrParameters * @return string Processed HTML output for the JS view tag */ @@ -203,7 +204,7 @@ public function viewJS($strReference,$arrParameters = array()){ * All other parameters passed in will be output as attributes of the IMG tag, for example title='Hello World' * * An example of the tag with the title and id parameters set {img:packages/Lavish/Resources/images/user.png,title='Hello World',id='user-77'} - * @param $strReference + * @param string $strReference * @param array $arrParameters * @return string */ @@ -249,7 +250,7 @@ public function viewImage($strReference,$arrParameters = array()){ * * To allow these overrides you must place a .htaccess file containing "Allow from all" in "app/Twist/Core/Resources/" or "app/Packages/Lavish/Resources/" * - * @param $dirPath + * @param string $dirPath * @return array An array of teh file name and the path and URI to the file */ protected function locateFile($dirPath){ @@ -297,9 +298,9 @@ protected function locateFile($dirPath){ /** * Process the JS files and output them in the desired HTML format - * @param $arrFiles - * @param $strPath - * @param $strURI + * @param array $arrFiles + * @param string $strPath + * @param string $strURI * @param bool $blInline * @param null|string $mxdAsyncType * @return string @@ -333,9 +334,9 @@ protected function processJS($arrFiles,$strPath,$strURI,$blInline = false,$mxdAs /** * Process the CSS files and output them in the desired HTML format - * @param $arrFiles - * @param $strPath - * @param $strURI + * @param array $arrFiles + * @param string $strPath + * @param string $strURI * @param bool $blInline * @param null|string $mxdAsyncType * @return string @@ -397,7 +398,7 @@ protected function loadLibraryManifest(){ /** * Get the correct package form the library - * @param $strRequestedResource + * @param string $strRequestedResource * @param null $strRequestedVersion * @return array */ @@ -425,8 +426,8 @@ protected function getFromLibrary( $strRequestedResource, $strRequestedVersion = /** * Apply the correct URI to a resource based on its resource directory path. - * @param $arrParameters - * @param $dirResourcePath + * @param array $arrParameters + * @param string $dirResourcePath * @return mixed */ protected function applyPath($arrParameters,$dirResourcePath){ @@ -446,8 +447,8 @@ protected function applyPath($arrParameters,$dirResourcePath){ /** * Extend the resource library with a whole new set of resources. This function can be called if you want to put some custom rescources into the system that the site or package can use. * The resources will then become accessible via the {resource:} view tag. - * @param $dirManifest - * @param $dirResourcePath + * @param string $dirManifest + * @param string $dirResourcePath * @throws \Exception */ public function extendLibrary($dirManifest,$dirResourcePath){ diff --git a/dist/twist/Core/Models/Session/Files.model.php b/dist/twist/Core/Models/Session/Files.model.php index 63739a08..14b0dc8a 100755 --- a/dist/twist/Core/Models/Session/Files.model.php +++ b/dist/twist/Core/Models/Session/Files.model.php @@ -86,12 +86,8 @@ public function read($intSessionID){ public function write($intSessionID, $mxdData){ - $blOut = false; - $strFile = sprintf("%s/sess_%s",$this->savePath,$intSessionID); - $blOut = (file_put_contents($strFile, $mxdData) === false) ? false : true; - - return $blOut; + return (file_put_contents($strFile, $mxdData) === false) ? false : true; } public function destroy($intSessionID){ diff --git a/dist/twist/Core/Models/Settings.model.php b/dist/twist/Core/Models/Settings.model.php index 538136b8..f62352fd 100755 --- a/dist/twist/Core/Models/Settings.model.php +++ b/dist/twist/Core/Models/Settings.model.php @@ -136,7 +136,7 @@ protected function loadTempSettings(){ /** * Get the setting value that is associated with the provided key, is the key does not exists NULL will be returned. - * @param $strKey + * @param string $strKey * @return null|mixed */ public function get($strKey){ @@ -145,7 +145,7 @@ public function get($strKey){ /** * Get all information that is associated with the provided key, is the key does not exists NULL will be returned. - * @param $strKey + * @param string $strKey * @return null */ public function getInfo($strKey){ @@ -154,8 +154,8 @@ public function getInfo($strKey){ /** * Set a value against a particular setting Key, the value will be stored in the Database or File depending on how TwistPHP has been configured. - * @param $strKey - * @param $mxdData + * @param string $strKey + * @param mixed $mxdData * @return bool */ public function set($strKey,$mxdData){ @@ -197,8 +197,8 @@ public function set($strKey,$mxdData){ /** * Remove/Uninstall a particular setting or group of settings form the Database or File depending on how TwistPHP has been configured. - * @param $strPackage - * @param $strGroup + * @param string $strPackage + * @param string $strGroup * @param null $strKey */ public function uninstall($strPackage,$strGroup,$strKey = null){ @@ -248,15 +248,15 @@ public function uninstall($strPackage,$strGroup,$strKey = null){ /** * Install/Add a new setting into the Database or File depending on how TwistPHP has been configured. - * @param $strPackage - * @param $strGroup - * @param $strKey - * @param $mxdValue - * @param $strTitle - * @param $strDescription - * @param $strDefault - * @param $strType - * @param $strOptions + * @param string $strPackage + * @param string $strGroup + * @param string $strKey + * @param mixed $mxdValue + * @param string $strTitle + * @param string $strDescription + * @param string $strDefault + * @param string $strType + * @param string $strOptions * @param bool $blNull * @return bool|null * @throws \Exception diff --git a/dist/twist/Core/Models/String/SyntaxHighlight.model.php b/dist/twist/Core/Models/String/SyntaxHighlight.model.php index f304e674..0372d3b2 100644 --- a/dist/twist/Core/Models/String/SyntaxHighlight.model.php +++ b/dist/twist/Core/Models/String/SyntaxHighlight.model.php @@ -28,7 +28,7 @@ class SyntaxHighlight{ /** * Get the contents of a file and highlight the code within the file, set a range above and below a focus point (Line No) - * @param $dirFile + * @param string $dirFile * @param string $strOutputType Choose from plain, em, table, dl (Plain puts line numbers in html comments) * @param null|int $intFocusLineNo Adding a focus line no. will activate $intFocusRange * @param int $intFocusRange Amount of lines to display above and below the focus line @@ -40,7 +40,7 @@ public static function file($dirFile,$strOutputType = 'plain',$intFocusLineNo = /** * Hightlight some code that has been passed in, set a range above and below a focus point (Line No) - * @param $strCode + * @param string $strCode * @param string $strOutputType Choose from plain, em, table, dl (Plain puts line numbers in html comments) * @param null|int $intFocusLineNo Adding a focus line no. will activate $intFocusRange * @param int $intFocusRange Amount of lines to display above and below the focus line @@ -52,7 +52,7 @@ public static function code($strCode,$strOutputType = 'plain',$intFocusLineNo = /** * Process the code that has been passed in, highlight and output - * @param $strCode + * @param string $strCode * @param string $strOutputType Choose from plain, em, table, dl (Plain puts line numbers in html comments) * @param null|int $intFocusLineNo Adding a focus line no. will activate $intFocusRange * @param int $intFocusRange Amount of lines to display above and below the focus line @@ -120,7 +120,7 @@ protected static function processCode($strCode,$strOutputType,$intFocusLineNo,$i /** * Explode the highlighted code that has been returned, fix any unclosed/unopened tags - * @param $strCode + * @param string $strCode * @return array Each line of highlighted code as an array */ protected static function explodeLines($strCode){ @@ -178,11 +178,10 @@ protected static function explodeLines($strCode){ /** * Apply new styles to the code rather than the default ones - * @param $strFormattedCode + * @param string $strFormattedCode * @return mixed */ - protected static function convertStyles($strFormattedCode){ - //@todo Write some code to detect the default styles and replace them with custom ones if required + protected static function convertStyles($strFormattedCode){ //TODO: Write some code to detect the default styles and replace them with custom ones if required return $strFormattedCode; } } diff --git a/dist/twist/Core/Models/Tools.model.php b/dist/twist/Core/Models/Tools.model.php index 7bb47d20..b2e007cc 100755 --- a/dist/twist/Core/Models/Tools.model.php +++ b/dist/twist/Core/Models/Tools.model.php @@ -33,7 +33,7 @@ final class Tools{ /** * Similar to print_r but corrects issues such as booleans, also give more useful information about the data * - * @param $arrData + * @param array $arrData * @param string $strIndent * @return string */ @@ -87,8 +87,8 @@ public function arrayParse( $strKey, $arrData, $strSplitChar = '/' ) { /** * Remove an item from a multi-dimensional array using a key, the split char indicates a change in array level * - * @param $strKey - * @param $arrData + * @param string $strKey + * @param string $arrData * @param string $strSplitChar * @return array Returns either the original array or the array with the item removed */ @@ -107,9 +107,9 @@ public function arrayParseUnset( $strKey, $arrData, $strSplitChar = '/' ) { /** * Collapse a multidimensional array into a single associative array * - * @param $arrIn Array to transform - * @param string $strJoinChar Structure separator - * @param null $mxdPreviousKey Previous key encountered (used in the recursive process) + * @param array $arrIn Array to transform + * @param string $strJoinChar Structure separator + * @param mixed $mxdPreviousKey Previous key encountered (used in the recursive process) * @return array */ public function array3dTo2d( $arrIn, $strJoinChar = '/', $mxdPreviousKey = null ) { @@ -133,9 +133,9 @@ public function array3dTo2d( $arrIn, $strJoinChar = '/', $mxdPreviousKey = null /** * Transform an associative array into a multidimensional array using a key to define the structure * - * @param $arrIn Array to transform - * @param null $strMultiDimensionalKey Key in the array to use to define a structure - * @param string $strSplitChar Structure separator + * @param array $arrIn Array to transform + * @param null $strMultiDimensionalKey Key in the array to use to define a structure + * @param string $strSplitChar Structure separator * @return array */ public function array2dTo3d( $arrIn, $strMultiDimensionalKey = null, $strSplitChar = '/' ) { @@ -166,8 +166,8 @@ public function array2dTo3d( $arrIn, $strMultiDimensionalKey = null, $strSplitCh /** * Fully merge two multidimensional arrays and return the new merged array. * - * @param $arrPrimary Primary array - * @param $arrSecondary Secondary array + * @param array $arrPrimary Primary array + * @param array $arrSecondary Secondary array * @return mixed */ public function arrayMergeRecursive( $arrPrimary, $arrSecondary ) { @@ -208,8 +208,8 @@ public function arrayMergeRecursive( $arrPrimary, $arrSecondary ) { * 'contact' => array('id' => 3, 'name' => 'Contact', 'slug' => 'contact'), * ) * - * @param $arrData - * @param $strKeyField + * @param array $arrData + * @param string $strKeyField * @param bool $blGroup * @return array|bool */ @@ -290,10 +290,10 @@ public function arrayRelationalTree( $arrStructure, $strIDField = 'id', $strPare } /** - * @param $arrList - * @param $arrParents - * @param $strIDField - * @param $strChildrenKey + * @param array $arrList + * @param array $arrParents + * @param string $strIDField + * @param string $strChildrenKey * @return array */ private function buildRelationalTree( &$arrList, $arrParents, $strIDField, $strChildrenKey ) { @@ -325,9 +325,9 @@ public function varDump() { /** * Traverse the current URI in $_SERVER['REQUEST_URI'] or pass in a starting URI * - * @param $urlRelativePath - * @param $urlStartingURI - * @param $blPreserveQueryString Keep/merge the current query string with the query string of the redirect + * @param string $urlRelativePath + * @param string$urlStartingURI + * @param bool $blPreserveQueryString Keep/merge the current query string with the query string of the redirect * @return string Return the traversed URI */ public function traverseURI( $urlRelativePath, $urlStartingURI = null, $blPreserveQueryString = false ) { @@ -487,8 +487,8 @@ public function slug( $strRaw, $arrExistingSlugs = array(), $intMaxLength = null /** * Create a 'zipped' string of characters (useful for sha1() + uniqid() to avoid similar-looking uniqid()'s) * - * @param $strString1 - * @param $strString2 + * @param string $strString1 + * @param string $strString2 * @return string */ public function zipStrings( $strString1, $strString2 ) { diff --git a/dist/twist/Core/Models/User/Auth.model.php b/dist/twist/Core/Models/User/Auth.model.php index 509ab028..2a6c4b48 100755 --- a/dist/twist/Core/Models/User/Auth.model.php +++ b/dist/twist/Core/Models/User/Auth.model.php @@ -85,8 +85,9 @@ public static function current(){ /** * Log the user in and generate an active session (Stores session data into the browser) - * @param $strEmail - * @param $strPassword + * @param string $strEmail + * @param string $strPassword + * @param bool $blRememberMeCookie * @return array */ public static function login($strEmail,$strPassword,$blRememberMeCookie = false){ @@ -128,8 +129,8 @@ public static function login($strEmail,$strPassword,$blRememberMeCookie = false) /** * Validate a users credentials without logging the user into the system - * @param $strEmail - * @param $strPassword + * @param string $strEmail + * @param string $strPassword * @return array */ public static function validate($strEmail,$strPassword){ @@ -190,7 +191,7 @@ public static function validate($strEmail,$strPassword){ /** * Log the user out of the system - * @return array + * @return bool */ public static function logout(){ diff --git a/dist/twist/Core/Models/User/SessionHandler.model.php b/dist/twist/Core/Models/User/SessionHandler.model.php index 8b9d35ff..f3258663 100755 --- a/dist/twist/Core/Models/User/SessionHandler.model.php +++ b/dist/twist/Core/Models/User/SessionHandler.model.php @@ -33,7 +33,7 @@ class SessionHandler{ /** * Set the device cookie life in seconds (Default: 31536000 == 1 year) - * @param $intDeviceLife + * @param integer $intDeviceLife */ public function setDeviceLife($intDeviceLife = 31536000){ $this->intDeviceLife = $intDeviceLife; @@ -41,7 +41,7 @@ public function setDeviceLife($intDeviceLife = 31536000){ /** * Set the device cookie life in seconds (Default: 604800 == 7 Days) - * @param $intSessionLife + * @param integer $intSessionLife */ public function setSessionLife($intSessionLife = 604800){ $this->intSessionLife = $intSessionLife; @@ -156,7 +156,7 @@ public function getDeviceID(){ } /** - * @param $strDeviceID + * @param string $strDeviceID * @return bool */ public function deleteDeviceID($strDeviceID){ @@ -164,7 +164,7 @@ public function deleteDeviceID($strDeviceID){ } /** - * @param $intUserID + * @param integer $intUserID * @return array */ public function getDeviceList($intUserID){ @@ -172,7 +172,7 @@ public function getDeviceList($intUserID){ } /** - * @param $intUserID + * @param integer $intUserID * @return array */ public function getCurrentDevice($intUserID){ @@ -201,9 +201,9 @@ public function getCurrentDevice($intUserID){ /** * Edit the name of a given device - * @param $intUserID - * @param $mxdDevice - * @param $strDeviceName + * @param integer $intUserID + * @param mixed $mxdDevice + * @param string $strDeviceName * @return bool */ public function editDevice($intUserID,$mxdDevice,$strDeviceName){ @@ -258,7 +258,7 @@ public function forget(){ /** * Get and set the device notifications status, if set a new device being used to login will send an email notification to the user. - * @param $intUserID + * @param integer $intUserID * @param null $blNotificationStatus * @return array|int|null|void */ @@ -288,7 +288,7 @@ public function remembered(){ /** * Create a remember me cookie session - * @param $intUserID + * @param integer $intUserID * @return string */ public function createCookie($intUserID){ @@ -297,7 +297,7 @@ public function createCookie($intUserID){ /** * Create a session key for use PHP session - * @param $intUserID + * @param integer $intUserID * @return string */ public function createCode($intUserID){ @@ -306,6 +306,7 @@ public function createCode($intUserID){ /** * Validate a remember me cookie session + * @param bool $blUpdateKey * @return int */ public function validateCookie($blUpdateKey = true){ @@ -316,7 +317,8 @@ public function validateCookie($blUpdateKey = true){ /** * Validate a remember me session code - * @param $strSessionKey + * @param string $strSessionKey + * @param bool $blUpdateKey * @return int */ public function validateCode($strSessionKey,$blUpdateKey = true){ @@ -455,8 +457,8 @@ protected function updateSession($strDevice,$strHash,$blRemember = false){ /** * Delete all session data for this key - * @param $strDevice - * @param $strHash + * @param string $strDevice + * @param string $strHash * @return bool */ protected function wipeSession($strDevice,$strHash){ diff --git a/dist/twist/Core/Models/User/User.model.php b/dist/twist/Core/Models/User/User.model.php index c54194dd..59aba7d9 100755 --- a/dist/twist/Core/Models/User/User.model.php +++ b/dist/twist/Core/Models/User/User.model.php @@ -287,7 +287,7 @@ public function delete(){ \Twist::Database()->records(TWIST_DATABASE_TABLE_PREFIX.'user_data')->delete($this->resDatabaseRecord->get('id'),'user_id',null); - //@todo remove sessions and devices + //TODO: remove sessions and devices return \Twist::Database()->records(TWIST_DATABASE_TABLE_PREFIX.'users')->delete($this->resDatabaseRecord->get('id'),'id'); } diff --git a/dist/twist/Core/Models/UserAgent.model.php b/dist/twist/Core/Models/UserAgent.model.php index ec8ba011..5bb1b790 100755 --- a/dist/twist/Core/Models/UserAgent.model.php +++ b/dist/twist/Core/Models/UserAgent.model.php @@ -120,7 +120,7 @@ public static function detect($strUserAgent = null){ /** * Get device type by device key, these are the keys found in the devices.json file - * @param $strDeviceKey + * @param string $strDeviceKey * @return string */ public static function getDeviceType($strDeviceKey){ @@ -128,54 +128,52 @@ public static function getDeviceType($strDeviceKey){ self::loadData(); if(array_key_exists($strDeviceKey,self::$arrDevices)){ - $strOut = self::$arrDevices[$strDeviceKey]['device']; + return self::$arrDevices[$strDeviceKey]['device']; }else{ - $strOut = self::$arrUnknown['device']; + return self::$arrUnknown['device']; } - - return $strOut; } /** * Get OS details from a device key, these are the keys found in the devices.json file - * @param $strDeviceKey + * @param string $strDeviceKey * @return array */ public static function getOS($strDeviceKey){ self::loadData(); - $arrOut = array(); if(array_key_exists($strDeviceKey,self::$arrDevices)){ + $arrOut = array(); $arrOut['key'] = $strDeviceKey; $arrOut['title'] = self::$arrDevices[$strDeviceKey]['os']; $arrOut['version'] = self::$arrDevices[$strDeviceKey]['version']; $arrOut['fa-icon'] = self::$arrDevices[$strDeviceKey]['fa-icon']; + + return $arrOut; }else{ - $arrOut = self::$arrUnknown['os']; + return self::$arrUnknown['os']; } - - return $arrOut; } /** * Get Browser details from a browser key, these are the keys found in the browsers.json file - * @param $strBrowserKey + * @param string $strBrowserKey * @return array */ public static function getBrowser($strBrowserKey){ self::loadData(); - $arrOut = array(); if(array_key_exists($strBrowserKey,self::$arrBrowsers)){ + $arrOut = array(); $arrOut['key'] = $strBrowserKey; $arrOut['title'] = self::$arrBrowsers[$strBrowserKey]['browser']; $arrOut['fa-icon'] = self::$arrBrowsers[$strBrowserKey]['fa-icon']; + + return $arrOut; }else{ - $arrOut = self::$arrUnknown['browser']; + return self::$arrUnknown['browser']; } - - return $arrOut; } } \ No newline at end of file diff --git a/dist/twist/Core/Models/Validate/Validator.model.php b/dist/twist/Core/Models/Validate/Validator.model.php index ccc0a807..b0356549 100755 --- a/dist/twist/Core/Models/Validate/Validator.model.php +++ b/dist/twist/Core/Models/Validate/Validator.model.php @@ -177,7 +177,7 @@ public function checkRegX($strKey,$strExpression,$blAllowBlank = false,$blRequir * type - Contains the type of problem encountered pass|blank|invalid|missing * message - The message contains a basic human readable description of the problem * - * @param $arrData + * @param array $arrData * @return array */ public function test(&$arrData){ @@ -263,7 +263,7 @@ public function test(&$arrData){ if(array_key_exists($arrEachCheck['key2'],$arrData)){ $arrData[$arrEachCheck['key2']] = $mxdTestValue2; }elseif(strstr($arrEachCheck['key2'],'/')){ - //Todo the callback update + //TODO: The callback update } } @@ -271,7 +271,7 @@ public function test(&$arrData){ if(array_key_exists($strKey,$arrData)){ $arrData[$strKey] = $mxdTestResult; }elseif(strstr($strKey,'/')){ - //Todo the callback update + //TODO: The callback update } $this->testResult($strKey,true,sprintf("%s has passed all checks",$this->keyToText($strKey))); diff --git a/dist/twist/Core/Routes/Base.route.php b/dist/twist/Core/Routes/Base.route.php index 7c376d09..b4280017 100755 --- a/dist/twist/Core/Routes/Base.route.php +++ b/dist/twist/Core/Routes/Base.route.php @@ -38,7 +38,7 @@ class Base extends Route{ /** * Called when the routes package launches a routes file. A routes file is usually a pre-defined set of route found withing an installable package. - * @param $strPackageKey + * @param string $strPackageKey */ public function __construct($strPackageKey){ @@ -60,7 +60,7 @@ public function __construct($strPackageKey){ /** * Function to detect if a package exists or has been installed - * @param $strModule + * @param string $strModule * @throws \Exception */ protected function packageRequired($strModule){ diff --git a/dist/twist/Core/Routes/Manager.route.php b/dist/twist/Core/Routes/Manager.route.php index 1bf76292..5a65dc29 100755 --- a/dist/twist/Core/Routes/Manager.route.php +++ b/dist/twist/Core/Routes/Manager.route.php @@ -27,7 +27,7 @@ /** * Manager route file that registers all the routes and restrictions required to allow the Manager to be run. * The manager route can be easily added to your site by calling the Twist::Route()->manager() alias function. - * @package Twist\Core\Routes + * @package string|Twist\Core\Routes */ class Manager extends Base{ diff --git a/dist/twist/Core/Utilities/Archive.utility.php b/dist/twist/Core/Utilities/Archive.utility.php index 5eb6bd14..93bfb97d 100755 --- a/dist/twist/Core/Utilities/Archive.utility.php +++ b/dist/twist/Core/Utilities/Archive.utility.php @@ -65,7 +65,7 @@ public function __construct(){ /** * Create a new empty archive ready to have files and directories added - * @param $dirZipArchive Full path for the new Zip archive, the Archive will be created here + * @param string $dirZipArchive Full path for the new Zip archive, the Archive will be created here */ public function create($dirZipArchive = null){ @@ -81,7 +81,7 @@ public function create($dirZipArchive = null){ /** * Load in an existing archive to be modified or added to - * @param $dirZipArchive Full path to an existing Zip archive (on the server) + * @param string $dirZipArchive Full path to an existing Zip archive (on the server) */ public function load($dirZipArchive){ $this->dirZipFile = $dirZipArchive; @@ -90,7 +90,7 @@ public function load($dirZipArchive){ /** * Set the main comment to display in the archive - * @param $strComment + * @param string $strComment */ public function setComment($strComment){ $this->resHandler->setArchiveComment($strComment); @@ -98,8 +98,8 @@ public function setComment($strComment){ /** * Add a file or directory to the current Zip Archive, the archive must be loaded or created using the 'load' or 'create' functions - * @param $dirLocalFile Full path to the local file that will be added to the Zip Archive - * @param $dirZipBasePath Base path to place the file within the zip, leave blank for the zip root + * @param string $dirLocalFile Full path to the local file that will be added to the Zip Archive + * @param string $dirZipBasePath Base path to place the file within the zip, leave blank for the zip root */ public function addFile($dirLocalFile,$dirZipBasePath = ''){ $this->addItem($dirLocalFile,$dirZipBasePath); @@ -107,7 +107,7 @@ public function addFile($dirLocalFile,$dirZipBasePath = ''){ /** * Add an empty directory to the zip, the directory path must be set from the root of the zip - * @param $dirZipDirectoryPath Path of the empty directory to create + * @param string $dirZipDirectoryPath Path of the empty directory to create */ public function addEmptyDirectory($dirZipDirectoryPath = ''){ @@ -120,7 +120,7 @@ public function addEmptyDirectory($dirZipDirectoryPath = ''){ /** * Delete a file or directory from the current ZIP file - * @param $dirZipFilePath Path of the file to be deleted + * @param string $dirZipFilePath Path of the file to be deleted */ public function deleteFile($dirZipFilePath = ''){ @@ -133,7 +133,7 @@ public function deleteFile($dirZipFilePath = ''){ /** * Decides how to deal with the path being entered into the zip - * @param $dirLocalPath Local path of hte item to be added + * @param string $dirLocalPath Local path of hte item to be added * @param string $strCurrentPath Base path within the zip where the item will be addded */ protected function addItem($dirLocalPath,$strCurrentPath = ''){ @@ -171,6 +171,7 @@ protected function addItem($dirLocalPath,$strCurrentPath = ''){ /** * Finish and save the archive * If a temp file a new save file must be passed in otherwise the temp file will be deleted + * @param string $dirSaveFile */ public function save($dirSaveFile = null){ @@ -188,6 +189,7 @@ public function save($dirSaveFile = null){ /** * Serve the newly created archive to the browser, this will allow the user to download the Archive to there computer * Temp files are deleted upon serve + * @param string $strFileName */ public function serve($strFileName = null){ @@ -199,7 +201,7 @@ public function serve($strFileName = null){ /** * Extract the loaded Zip Archive to a given folder on the local server - * @param $dirExtractPath Full path to the local directory in which to extract the archive + * @param string $dirExtractPath Full path to the local directory in which to extract the archive */ public function extract($dirExtractPath){ $this->resHandler->extract($dirExtractPath); diff --git a/dist/twist/Core/Utilities/Asset.utility.php b/dist/twist/Core/Utilities/Asset.utility.php index aea8e718..e401d421 100755 --- a/dist/twist/Core/Utilities/Asset.utility.php +++ b/dist/twist/Core/Utilities/Asset.utility.php @@ -63,7 +63,7 @@ public function __construct(){ /** * Get an asset by Asset ID, this will also expand the asset to include a sub array of its type and group information * - * @param $intAssetID ID of the required asset + * @param integer $intAssetID ID of the required asset * @return array Returns an array of the assets information */ public function get($intAssetID){ @@ -78,6 +78,8 @@ public function get($intAssetID){ * Get all the assets in the asset system, this will also expand the asset to include a sub array of its type and group information * * @related get + * @param string $strOrderBy + * @param string $strOrderDirection * @return array Returns a multi-dimensional array of all the assets in the system */ public function getAll($strOrderBy='added',$strOrderDirection='DESC'){ @@ -98,7 +100,7 @@ public function getAll($strOrderBy='added',$strOrderDirection='DESC'){ * Get all assets that of a asset group by Asset Group ID, this will also expand the asset to include a sub array of its type and group information * * @related get - * @param $intGroupID ID of the required asset group + * @param integer $intGroupID ID of the required asset group * @param string $strOrderBy field to order the results by * @param string $strOrderDirection directional order of the results * @return array Returns a multi-dimensional array of the groups assets @@ -121,7 +123,7 @@ public function getByGroup($intGroupID,$strOrderBy='added',$strOrderDirection='D * Get all assets of a particular type by Asset Type ID, this will also expand the asset to include a sub array of its type and group information * * @related get - * @param $intTypeID ID of the required asset type + * @param integer $intTypeID ID of the required asset type * @param string $strOrderBy field to order the results by * @param string $strOrderDirection directional order of the results * @return array Returns a multi-dimensional array of assets @@ -143,7 +145,7 @@ public function getByType($intTypeID,$strOrderBy='added',$strOrderDirection='DES /** * Expand the assets default array of date to include extra data such as detailed type/group information * - * @param $arrAsset Default asset array before expansion + * @param array $arrAsset Default asset array before expansion * @return array Expanded asset array */ private function expand($arrAsset){ @@ -172,7 +174,7 @@ private function expand($arrAsset){ /** * Get all the supporting content for this asset, this includes thumbnails and alternative sizes/formats. If none are found the default icon set will be returned. * - * @param $arrAsset Default asset array before expansion + * @param array $arrAsset Default asset array before expansion * @return array Returns array of supporting content */ public function getSupportingContent($arrAsset){ @@ -195,7 +197,7 @@ public function getSupportingContent($arrAsset){ * Get all the default content icons the the assets type * * @related getSupportingContent - * @param $arrAsset Default asset array before expansion + * @param array $arrAsset Default asset array before expansion * @return array Returns array of default content icons */ public function getDefaultSupportingContent($arrAsset){ @@ -219,7 +221,7 @@ public function getDefaultSupportingContent($arrAsset){ /** * Get an array of asset type information by its asset type ID * - * @param $intTypeID ID of the required asset type + * @param integer $intTypeID ID of the required asset type * @return array Returns an array of the asset type information */ public function getType($intTypeID){ @@ -230,7 +232,7 @@ public function getType($intTypeID){ * Get an array of asset type information by its asset type slug * * @related getType - * @param $strTypeSlug Slug of the required asset type + * @param string $strTypeSlug Slug of the required asset type * @return array Returns an array of the asset type information */ public function getTypeBySlug($strTypeSlug){ @@ -240,7 +242,7 @@ public function getTypeBySlug($strTypeSlug){ /** * Get an array of asset group information by its asset group ID * - * @param $intGroupID ID of the required asset group + * @param integer $intGroupID ID of the required asset group * @return array Returns an array of the asset group information */ public function getGroup($intGroupID){ @@ -251,7 +253,7 @@ public function getGroup($intGroupID){ * Get an array of asset group information by its asset group slug * * @related getGroup - * @param $strGroupSlug Slug of the required asset type + * @param string $strGroupSlug Slug of the required asset type * @return array Returns an array of the asset group information */ public function getGroupBySlug($strGroupSlug){ @@ -282,8 +284,8 @@ public function getGroupTree(){ * Add a new group to the asset groups table, the asset groups will allow you slit/categorise your assets into manageable groups. * @related getGroup * - * @param $strDescription Description of the group - * @param $srtSlug Slug of the group, used to reference the group + * @param string $strDescription Description of the group + * @param string $srtSlug Slug of the group, used to reference the group * @return int ID of the newly created group */ public function addGroup($strDescription,$srtSlug){ @@ -300,17 +302,17 @@ public function addGroup($strDescription,$srtSlug){ /** * Update a asset group, change the group description and slug without affecting the assets contained within the group. * - * @param $intGroupID ID of the asset group to be updated - * @param $strDescription Description of the group - * @param $srtSlug Slug of the group, used to reference the group + * @param integer $intGroupID ID of the asset group to be updated + * @param string $strDescription Description of the group + * @param string $strSlug Slug of the group, used to reference the group * @return bool Returns the status of the update */ - public function editGroup($intGroupID,$strDescription,$srtSlug){ + public function editGroup($intGroupID,$strDescription,$strSlug){ //Create the asset group record in the database $resRecord = \Twist::Database()->records(TWIST_DATABASE_TABLE_PREFIX.'asset_groups')->get($intGroupID); $resRecord->set('description',$strDescription); - $resRecord->set('slug',$srtSlug); + $resRecord->set('slug',$strSlug); $resRecord->set('created',\Twist::DateTime()->date('Y-m-d H:i:s')); return $resRecord->commit(); @@ -320,11 +322,11 @@ public function editGroup($intGroupID,$strDescription,$srtSlug){ * Add an asset to the system, the asset type will be detected automatically. The asset group must be passed in as a group ID. * In the first parameter you can either pass in a string i.e URL, Youtube Link, Co-ordinates or a full path to a file i.e /my/file/to/add/file.ext * - * @param $mxdData - * @param $intGroupID Initial group for the asset to be added - * @param $strTitle Title of the asset - * @param $strDescription Description for the asset - * @param $blActive Default status of the asset once created in the system + * @param mixed $mxdData + * @param integer $intGroupID Initial group for the asset to be added + * @param string $strTitle Title of the asset + * @param string $strDescription Description for the asset + * @param bool $blActive Default status of the asset once created in the system * @return int Returns the ID of the newly added asset */ public function add($mxdData,$intGroupID,$strTitle='',$strDescription='',$blActive=true){ @@ -462,11 +464,11 @@ public function add($mxdData,$intGroupID,$strTitle='',$strDescription='',$blActi * Upload an asset to the system (utilises 'add' to store the asset once uploaded), the asset type will be detected automatically. An asset group must be provided. * * @related add - * @param $strFileKey File upload key from the $_FILES array - * @param $intGroupID Initial group for the asset to be added - * @param $strTitle Title of the asset - * @param $strDescription Description for the asset - * @param $blActive Default status of the asset once created in the system + * @param string $strFileKey File upload key from the $_FILES array + * @param integer $intGroupID Initial group for the asset to be added + * @param string $strTitle Title of the asset + * @param string $strDescription Description for the asset + * @param bool $blActive Default status of the asset once created in the system * @return int Returns the ID of the newly uploaded/added asset */ public function upload($strFileKey,$intGroupID,$strTitle='',$strDescription='',$blActive=true){ @@ -485,11 +487,11 @@ public function upload($strFileKey,$intGroupID,$strTitle='',$strDescription='',$ * Import an asset into the system (utilises 'add' to store the asset once uploaded), the asset type will be detected automatically. An asset group must be provided. * * @related add - * @param $mxdFile A filepath or URL to import - * @param $intGroupID Initial group for the asset to be added - * @param $strTitle Title of the asset - * @param $strDescription Description for the asset - * @param $blActive Default status of the asset once created in the system + * @param string $mxdFile A filepath or URL to import + * @param integer $intGroupID Initial group for the asset to be added + * @param string $strTitle Title of the asset + * @param string $strDescription Description for the asset + * @param bool $blActive Default status of the asset once created in the system * @return int Returns the ID of the newly uploaded/added asset */ @@ -507,9 +509,9 @@ public function import($mxdFile,$intGroupID,$strTitle='',$strDescription='',$blA /** * Edit the title and description of an asset by its asset ID * - * @param $intAssetID ID of the asset to be updated - * @param $strTitle Title to be stored for the provided asset ID - * @param $strDescription Description to be stored for the provided asset ID + * @param integer $intAssetID ID of the asset to be updated + * @param string $strTitle Title to be stored for the provided asset ID + * @param string $strDescription Description to be stored for the provided asset ID * @return bool Returns that status of the update */ public function edit($intAssetID,$strTitle,$strDescription=''){ @@ -524,8 +526,8 @@ public function edit($intAssetID,$strTitle,$strDescription=''){ /** * Set the status of an asset between active/inactive by passing a boolean of either true or false in the second parameter. * - * @param $intAssetID ID of the asset to be updated - * @param $blActive Status in which to set the enabled field + * @param integer $intAssetID ID of the asset to be updated + * @param bool $blActive Status in which to set the enabled field * @return bool Returns that status of teh update */ public function active($intAssetID,$blActive=true){ @@ -539,7 +541,7 @@ public function active($intAssetID,$blActive=true){ /** * Delete an asset from the system, this will remove both the database record and the file (if there is one) * - * @param $intAssetID ID of the asset to be deleted + * @param integer $intAssetID ID of the asset to be deleted * @return bool Returns that status of the delete command */ public function delete($intAssetID){ @@ -578,8 +580,9 @@ public function delete($intAssetID){ * {asset:inline,type} * * @extends Template - * @param $strReference View tag passed in from a tpl file - * @return string Formatted HTML/Markup to be output by the View utility + * @param string $strReference View tag passed in from a tpl file + * @param array $arrParameters + * @return mixed|string Formatted HTML/Markup to be output by the View utility */ public function viewExtension($strReference,$arrParameters = array()){ diff --git a/dist/twist/Core/Utilities/CSV.utility.php b/dist/twist/Core/Utilities/CSV.utility.php index 9fbe520a..3d682f53 100755 --- a/dist/twist/Core/Utilities/CSV.utility.php +++ b/dist/twist/Core/Utilities/CSV.utility.php @@ -32,10 +32,10 @@ class CSV extends Base{ /** * Create a CSV file on the server, pass in a multi-dimensional array of data containing keys and values, the keys will be used as the field names and the values will be each for in the CSV. By default the Delimiter, Enclosure and Escape are already set. * - * @param $strLocalFile Full path to the local CSV file to be stored - * @param $arrData Multi-dimensional array of data to be converted into a CSV - * @param $strDelimiter Delimiter to be used in creation of CSV data - * @param $strEnclosure Enclosure to be used in creation of CSV data + * @param string $strLocalFile Full path to the local CSV file to be stored + * @param array $arrData Multi-dimensional array of data to be converted into a CSV + * @param string $strDelimiter Delimiter to be used in creation of CSV data + * @param string $strEnclosure Enclosure to be used in creation of CSV data * * @return mixed Returns the CSV data as a string */ @@ -52,10 +52,10 @@ public function export( $strLocalFile, $arrData, $strDelimiter = ',', $strEnclos /** * Create a CSV file and serve to the user, pass in a multi-dimensional array of data containing keys and values, the keys will be used as the field names and the values will be each for in the CSV. By default the Delimiter, Enclosure and Escape are already set. * - * @param $strFileName Name of the file to be served as a downloadable file - * @param $arrData Multi-dimensional array of data to be converted into a CSV - * @param $strDelimiter Delimiter to be used in creation of CSV data - * @param $strEnclosure Enclosure to be used in creation of CSV data + * @param string $strFileName Name of the file to be served as a downloadable file + * @param array $arrData Multi-dimensional array of data to be converted into a CSV + * @param string $strDelimiter Delimiter to be used in creation of CSV data + * @param string $strEnclosure Enclosure to be used in creation of CSV data */ public function serve( $strFileName, $arrData, $strDelimiter = ',', $strEnclosure = '"' ) { @@ -72,9 +72,9 @@ public function serve( $strFileName, $arrData, $strDelimiter = ',', $strEnclosur /** * Generate the CSV data from a multi-dimensional array of data, ability to use a custom delimiter and enclosure. * - * @param $arrData Multi-dimensional array of data to be converted into a CSV - * @param $strDelimiter Delimiter to be used in creation of CSV data - * @param $strEnclosure Enclosure to be used in creation of CSV data + * @param array $arrData Multi-dimensional array of data to be converted into a CSV + * @param string $strDelimiter Delimiter to be used in creation of CSV data + * @param string $strEnclosure Enclosure to be used in creation of CSV data * * @return mixed Returns the CSV data as a string */ @@ -98,18 +98,18 @@ protected function generateCSV( $arrData, $strDelimiter = ',', $strEnclosure = ' /** * Pass in the local file path to a CSV file, the CSV file will be parsed and turned into an array. By default the Delimiter, Enclosure and Escape are already set. * - * @param $strLocalFile Full path to the local CSV file that will be imported - * @param $strLineDelimiter Expected delimiter for each line used in the CSV - * @param $intFieldDelimiter Expected delimiter for each field used in the CSV - * @param $strEnclosure Expected enclosure to be used in creation of CSV data - * @param $strEscape String used to escape the CSV data (Only used if mbstring is enabled in PHP) - * @param $blUseFirstRowAsKeys If TRUE, the first row of data is returned as the indexes for the array data - * @param $strEncoding Output encoding (defaults to UTF-8) - * @param $strLocale Expected inout locale (default of en_GB.UTF-8 ensures multibyte strings are safe) + * @param string $strLocalFile Full path to the local CSV file that will be imported + * @param string $strLineDelimiter Expected delimiter for each line used in the CSV + * @param string $strFieldDelimiter Expected delimiter for each field used in the CSV + * @param string $strEnclosure Expected enclosure to be used in creation of CSV data + * @param string $strEscape String used to escape the CSV data (Only used if mbstring is enabled in PHP) + * @param bool $blUseFirstRowAsKeys If TRUE, the first row of data is returned as the indexes for the array data + * @param string $strEncoding Output encoding (defaults to UTF-8) + * @param string $strLocale Expected inout locale (default of en_GB.UTF-8 ensures multibyte strings are safe) * * @return array Returns Multi-dimensional array of the CSV data */ - public function import( $strLocalFile, $strLineDelimiter = "\n", $intFieldDelimiter = ',', $strEnclosure = '"', $strEscape = '\\', $blUseFirstRowAsKeys = false, $strEncoding = 'UTF-8', $strLocale = 'en_GB.UTF-8' ) { + public function import( $strLocalFile, $strLineDelimiter = "\n", $strFieldDelimiter = ',', $strEnclosure = '"', $strEscape = '\\', $blUseFirstRowAsKeys = false, $strEncoding = 'UTF-8', $strLocale = 'en_GB.UTF-8' ) { $arrOut = $arrHeaders = array(); @@ -132,7 +132,7 @@ public function import( $strLocalFile, $strLineDelimiter = "\n", $intFieldDelimi $strRow = mb_convert_encoding($strRow, $strEncoding, mb_detect_encoding($strRow)); } - $arrRow = str_getcsv( $strRow, $intFieldDelimiter, $strEnclosure, $strEscape ); + $arrRow = str_getcsv( $strRow, $strFieldDelimiter, $strEnclosure, $strEscape ); if( $blUseFirstRowAsKeys ) { if( $intRow === 0 ) { diff --git a/dist/twist/Core/Utilities/Cache.utility.php b/dist/twist/Core/Utilities/Cache.utility.php index 7b028a49..3f31dc93 100755 --- a/dist/twist/Core/Utilities/Cache.utility.php +++ b/dist/twist/Core/Utilities/Cache.utility.php @@ -42,7 +42,7 @@ class Cache extends Base{ /** * Load all the default options for the cache system, create folders and '.htaccess' if required. - * @param $strInstanceKey Instance key to help group cache data + * @param string $strInstanceKey Instance key to help group cache data */ public function __construct($strInstanceKey){ @@ -80,7 +80,8 @@ public function __construct($strInstanceKey){ /** * Set/Get the storage location for cache files - * @param $dirStorageLocation Full path to the new storage location + * @param string $dirStorageLocation Full path to the new storage location + * @return null|string */ public function location($dirStorageLocation = null){ @@ -93,7 +94,8 @@ public function location($dirStorageLocation = null){ /** * Set/Get the cache file extension that will be used when storing cache files - * @param $strFileExtension Custom cache file extension to use + * @param string $strFileExtension Custom cache file extension to use + * @return null|string */ public function extension($strFileExtension = null){ @@ -108,9 +110,9 @@ public function extension($strFileExtension = null){ * Store data in the cache, default life time is 1 hour (3600 seconds). Setting the life time to '0' will mean that the cache will be stored as a PHP Runtime Session and will be no longer exists once the current runtime has ended. * A Unique ID must be passed in so that you can reference the data again later. * - * @param $strUniqueID Unique ID used to reference the cache - * @param $mxdData Data to be stored in the cache - * @param $intLifeTime Life of the cache, time until expiry + * @param string|integer $mxdUniqueID Unique ID used to reference the cache + * @param string|array $mxdData Data to be stored in the cache + * @param integer $intLifeTime Life of the cache, time until expiry */ public function write($mxdUniqueID,$mxdData,$intLifeTime = 3600){ @@ -140,7 +142,7 @@ public function write($mxdUniqueID,$mxdData,$intLifeTime = 3600){ /** * Retrieve the data form the cache at any point by passing in the Unique ID. Expired cache date will be purged and passed back as NULL in the result. * - * @param $mxdUniqueID string Unique ID used to reference the cache + * @param mixed $mxdUniqueID string Unique ID used to reference the cache * @return mixed Returns cache data or array of cache properties */ public function read($mxdUniqueID){ @@ -171,7 +173,7 @@ public function read($mxdUniqueID){ /** * Remove a cache manually (before expiry) if you want to stop using it or no longer require its contents. Pass in the Unique ID to reference the cache you want to remove, alternatively passing in null will remove all cache files for this instance. * - * @param $mxdUniqueID Unique ID used to reference the cache + * @param mixed $mxdUniqueID Unique ID used to reference the cache * @return bool Status of the cache removal */ public function remove($mxdUniqueID = null){ @@ -199,7 +201,7 @@ public function remove($mxdUniqueID = null){ /** * Get the created time for the cache file - * @param $mxdUniqueID + * @param mixed $mxdUniqueID * @return int|null */ public function created($mxdUniqueID){ @@ -222,7 +224,7 @@ public function created($mxdUniqueID){ /** * Get the last modified time of the cache file - * @param $mxdUniqueID + * @param mixed $mxdUniqueID * @return int|null */ public function modified($mxdUniqueID){ @@ -240,7 +242,7 @@ public function modified($mxdUniqueID){ /** * Get the expiry timestamp of a cache file by its unique ID - * @param $mxdUniqueID + * @param mixed $mxdUniqueID * @return null * @throws \Exception */ @@ -271,8 +273,8 @@ public function clean(){ /** * Cleans out a directory and all its sub directories - * @param $strDirectory - * @param $intCurrentTime + * @param string $strDirectory + * @param integer $intCurrentTime */ protected function cleanDirectory($strDirectory,$intCurrentTime){ diff --git a/dist/twist/Core/Utilities/Command.utility.php b/dist/twist/Core/Utilities/Command.utility.php index 7fe1ea57..ba75cc51 100755 --- a/dist/twist/Core/Utilities/Command.utility.php +++ b/dist/twist/Core/Utilities/Command.utility.php @@ -32,8 +32,8 @@ class Command extends Base{ /** * Pass in the bash command to be executed on the server, the result will be formatted as an array with overall status, return code and error messages in an error array. * You can override the current working directory, by default the current working directory is you document root. Commands can either be written utilising full path stings or they can be relative to the current working directory. - * @param $strCommand Correctly formatted bash command - * @param $dirCurrentWorkingDirectory Override of your current working directory + * @param string $strCommand Correctly formatted bash command + * @param string $dirCurrentWorkingDirectory Override of your current working directory * @return array Formatted array of data containing the fields command, status, output, errors, return */ public function execute($strCommand,$dirCurrentWorkingDirectory = null){ diff --git a/dist/twist/Core/Utilities/Cookie.utility.php b/dist/twist/Core/Utilities/Cookie.utility.php index 8297b534..c83e2b27 100755 --- a/dist/twist/Core/Utilities/Cookie.utility.php +++ b/dist/twist/Core/Utilities/Cookie.utility.php @@ -33,7 +33,7 @@ class Cookie extends Base{ /** * Returns true if there is a cookie with this name. * - * @param string $name + * @param string $strName * @return bool */ public function exists($strName){ @@ -44,8 +44,7 @@ public function exists($strName){ * Get the value of the given cookie. If the cookie does not exist the value * of $default will be returned. * - * @param string $name - * @param string $default + * @param string $strName * @return mixed */ public function get($strName){ @@ -55,11 +54,11 @@ public function get($strName){ /** * Set a cookie. Silently does nothing if headers have already been sent. * - * @param string $name - * @param string $value - * @param mixed $expiry - * @param string $path - * @param string $domain + * @param string $strName + * @param mixed $mxdValue + * @param int $intExpiry + * @param string $strPath + * @param bool $strDomain * @return bool */ public function set($strName, $mxdValue, $intExpiry = 0, $strPath = '/', $strDomain = false){ @@ -95,10 +94,10 @@ public function set($strName, $mxdValue, $intExpiry = 0, $strPath = '/', $strDom /** * Delete a cookie. * - * @param string $name - * @param string $path - * @param string $domain - * @param bool $remove_from_global Set to true to remove this cookie from this request. + * @param string $strName + * @param string $strPath + * @param bool $strDomain + * @param bool $blRemoveFromGlobal * @return bool */ public function delete($strName, $strPath = '/', $strDomain = false, $blRemoveFromGlobal = false){ diff --git a/dist/twist/Core/Utilities/Curl.utility.php b/dist/twist/Core/Utilities/Curl.utility.php index c6e11ca3..30c3ab7e 100755 --- a/dist/twist/Core/Utilities/Curl.utility.php +++ b/dist/twist/Core/Utilities/Curl.utility.php @@ -48,7 +48,7 @@ function __construct(){ /** * Automatically return a JSON response as an array * - * @param $blEnable Determines if functionality should be used + * @param bool $blEnable Determines if functionality should be used */ public function decodeResponseJSON($blEnable = false){ $this->blResponseJSON = $blEnable; @@ -57,7 +57,7 @@ public function decodeResponseJSON($blEnable = false){ /** * Stop the system from URL encoding all parameters before they are sent * - * @param $blEnable Determines if functionality should be used + * @param bool $blEnable Determines if functionality should be used */ public function disableUrlEncoding($blEnable = true){ $this->blDisableUrlEncoding = $blEnable; @@ -66,7 +66,7 @@ public function disableUrlEncoding($blEnable = true){ /** * Tell Curl whether to verify the Host and Peer when making requests to HTTPS urls * - * @param $blEnable Determines if functionality should be enabled (Default setting: disabled) + * @param bool $blEnable Determines if functionality should be enabled (Default setting: disabled) */ public function verifySSLRequest($blEnable = true){ $this->blVerifySSLRequest = $blEnable; @@ -75,7 +75,7 @@ public function verifySSLRequest($blEnable = true){ /** * Set the max timeout for the requests to be made * - * @param $intTimeout Time in seconds + * @param integer $intTimeout Time in seconds */ public function setTimeout($intTimeout = 5){ $this->intTimeout = $intTimeout; @@ -84,7 +84,7 @@ public function setTimeout($intTimeout = 5){ /** * Set a custom user agent header to be used when making the request, pass in null to use default user agent * - * @param $strUserAgent Custom User Agent Header + * @param string $strUserAgent Custom User Agent Header */ public function setUserAgent($strUserAgent = null){ $this->strUserAgent = (is_null($strUserAgent)) ? $this->strDefaultUserAgent : $strUserAgent; @@ -93,8 +93,8 @@ public function setUserAgent($strUserAgent = null){ /** * Set a username and password, this will log you into any request that may have HTTP User Restriction in place * - * @param $strUsername Username required for the request - * @param $strPassword Password required for the request + * @param string $strUsername Username required for the request + * @param string $strPassword Password required for the request */ public function setUserPass($strUsername,$strPassword){ $this->strUserPassword = sprintf("%s:%s",$strUsername,$strPassword); @@ -103,10 +103,10 @@ public function setUserPass($strUsername,$strPassword){ /** * Encrypt the Curl request using a SSL certificate and key pair * - * @param $dirSSLCertificate The path of a file containing a PEM formatted certificate. - * @param $dirSSLKey The path of a file containing a private SSL key. - * @param $strCertificateType The format of the certificate. Supported formats are "PEM" (default), "DER", and "ENG". - * @param $strKeyType The key type of the private SSL key. Supported key types are "PEM" (default), "DER", and "ENG". + * @param string $dirSSLCertificate The path of a file containing a PEM formatted certificate. + * @param string $dirSSLKey The path of a file containing a private SSL key. + * @param string $strCertificateType The format of the certificate. Supported formats are "PEM" (default), "DER", and "ENG". + * @param string $strKeyType The key type of the private SSL key. Supported key types are "PEM" (default), "DER", and "ENG". */ public function setSSLCertificate($dirSSLCertificate,$dirSSLKey,$strCertificateType = 'PEM',$strKeyType = 'PEM'){ $this->arrSSLCertificate = array( @@ -120,7 +120,7 @@ public function setSSLCertificate($dirSSLCertificate,$dirSSLKey,$strCertificateT /** * Set the content type of the request, this will be merged with the headers array if required * - * @param $strContentType Content type of the body data (if required) + * @param string $strContentType Content type of the body data (if required) */ public function setContentType($strContentType){ $this->arrHeaders[] = sprintf("Content-Type: %s",trim($strContentType)); @@ -129,7 +129,7 @@ public function setContentType($strContentType){ /** * The contents of the "Cookie: " header to be used in the HTTP request. Note that multiple cookies are separated with a semicolon followed by a space (e.g., "fruit=apple; colour=red") * - * @param $strCookies The cookie content to be, separated multiple cookies with a semicolon followed by a space + * @param string $strCookies The cookie content to be, separated multiple cookies with a semicolon followed by a space */ public function setCookies($strCookies){ $this->strCookies = $strCookies; @@ -138,9 +138,9 @@ public function setCookies($strCookies){ /** * Make a GET request to the provided URL, set the User Agent header when required * - * @param $strURL Full URL for the request - * @param $arrRequestData Array of get parameters - * @param $arrHeaders Array of additional headers to be sent + * @param string $strURL Full URL for the request + * @param array $arrRequestData Array of get parameters + * @param array $arrHeaders Array of additional headers to be sent * @return mixed Returns the results of the request, will be an array if 'decodeResponseJSON' is enabled */ public function get($strURL,$arrRequestData = array(),$arrHeaders = array()){ @@ -153,9 +153,9 @@ public function get($strURL,$arrRequestData = array(),$arrHeaders = array()){ * * @related get * - * @param $strURL Full URL for the request - * @param $mxdRequestData Pass in an array of post parameters or raw body data of e.g. XML,JSON to be posted - * @param $arrHeaders Array of additional headers to be sent + * @param string $strURL Full URL for the request + * @param mixed $mxdRequestData Pass in an array of post parameters or raw body data of e.g. XML,JSON to be posted + * @param array $arrHeaders Array of additional headers to be sent * @return mixed Returns the results of the request, will be an array if 'decodeResponseJSON' is enabled */ public function post($strURL,$mxdRequestData = array(),$arrHeaders = array()){ @@ -167,10 +167,10 @@ public function post($strURL,$mxdRequestData = array(),$arrHeaders = array()){ * * @related get * - * @param $strURL Full URL for the request - * @param $strRawData Raw data to be posted - * @param $arrRequestData Array of get parameters - * @param $arrHeaders Array of additional headers to be sent + * @param string $strURL Full URL for the request + * @param string $strRawData Raw data to be posted + * @param array $arrRequestData Array of get parameters + * @param array $arrHeaders Array of additional headers to be sent * @return mixed Returns the results of the request, will be an array if 'decodeResponseJSON' is enabled */ public function put($strURL,$strRawData,$arrRequestData = array(),$arrHeaders = array()){ @@ -183,9 +183,9 @@ public function put($strURL,$strRawData,$arrRequestData = array(),$arrHeaders = * * @related get * - * @param $strURL Full URL for the request - * @param $mxdRequestData Pass in an array of post parameters or raw body data of e.g. XML,JSON to be posted - * @param $arrHeaders Array of additional headers to be sent + * @param string $strURL Full URL for the request + * @param mixed $mxdRequestData Pass in an array of post parameters or raw body data of e.g. XML,JSON to be posted + * @param array $arrHeaders Array of additional headers to be sent * @return mixed Returns the results of the request, will be an array if 'decodeResponseJSON' is enabled */ public function patch($strURL,$mxdRequestData = array(),$arrHeaders = array()){ @@ -198,9 +198,9 @@ public function patch($strURL,$mxdRequestData = array(),$arrHeaders = array()){ * * @related get * - * @param $strURL Full URL for the request - * @param $mxdRequestData Pass in an array of post parameters or raw body data of e.g. XML,JSON to be posted - * @param $arrHeaders Array of additional headers to be sent + * @param string $strURL Full URL for the request + * @param mixed $mxdRequestData Pass in an array of post parameters or raw body data of e.g. XML,JSON to be posted + * @param array $arrHeaders Array of additional headers to be sent * @return mixed Returns the results of the request, will be an array if 'decodeResponseJSON' is enabled */ public function delete($strURL,$mxdRequestData = array(),$arrHeaders = array()){ @@ -210,9 +210,10 @@ public function delete($strURL,$mxdRequestData = array(),$arrHeaders = array()){ /** * A method used but POST, PATCH and DELETE as they are all similar requests with a different method name * - * @param $strURL Full URL for the request - * @param $mxdRequestData Pass in an array of post parameters or raw body data of e.g. XML,JSON to be posted - * @param $arrHeaders Array of additional headers to be sent + * @param string $strURL Full URL for the request + * @param mixed $mxdRequestData Pass in an array of post parameters or raw body data of e.g. XML,JSON to be posted + * @param array $arrHeaders Array of additional headers to be sent + * @param string $strMethod * @return mixed Returns the results of the request, will be an array if 'decodeResponseJSON' is enabled */ protected function makePostRequest($strURL,$mxdRequestData = array(),$arrHeaders = array(),$strMethod = 'post'){ @@ -233,11 +234,11 @@ protected function makePostRequest($strURL,$mxdRequestData = array(),$arrHeaders /** * The function that makes the CURL requests, all data is passed in and the response is returned * - * @param $strURL Full URL for the request - * @param $arrRequestData Array of post/get parameters - * @param $strType HTTP protocol of the request - * @param $arrHeaders Array of additional headers to be sent - * @param $strRawData Raw data to be posted + * @param string $strURL Full URL for the request + * @param array $arrRequestData Array of post/get parameters + * @param string $strType HTTP protocol of the request + * @param array $arrHeaders Array of additional headers to be sent + * @param string $strRawData Raw data to be posted * @return mixed Returns the results of the request, will be an array if 'decodeResponseJSON' is enabled */ protected function makeRequest($strURL,$arrRequestData = array(),$strType = 'get',$arrHeaders=array(),$strRawData = ''){ @@ -392,7 +393,7 @@ public function getRequestError(){ /** * Parse the response headers and output them as an array of key value pairs - * @param string $strRawHeaders Raw response headers to be parsed + * @param mixed $mxdRawHeaders Raw response headers to be parsed * @return array Key Value pare of all response headers */ protected function httpParseHeaders($mxdRawHeaders){ diff --git a/dist/twist/Core/Utilities/Database.utility.php b/dist/twist/Core/Utilities/Database.utility.php index f87e262c..f92d1fe8 100755 --- a/dist/twist/Core/Utilities/Database.utility.php +++ b/dist/twist/Core/Utilities/Database.utility.php @@ -61,11 +61,11 @@ public function __destruct(){ /** * Make the main connection to the database, automatically called if a custom connection is not required - * @param $strHost - * @param $strUsername - * @param $strPassword - * @param $strDatabaseName - * @param $strProtocol + * @param string $strHost + * @param string $strUsername + * @param string $strPassword + * @param string $strDatabaseName + * @param string $strProtocol * @throws \Exception */ public function connect($strHost = null,$strUsername = null,$strPassword = null,$strDatabaseName = null,$strProtocol = null){ @@ -125,7 +125,7 @@ protected function connected(){ } if(is_object($this->resLibrary) && !$this->resLibrary->connected()){ - $strErrorMessage = $this->resLibrary->connectionError(); + $strErrorMessage = $this->resLibrary->connectionError(); //TODO: Remove? $this->resLibrary = null; throw new \Exception('Failed to connect to the database server'); } @@ -158,7 +158,7 @@ public function close(){ /** * Check for default settings for the database - * @param $blThrowException + * @param bool $blThrowException * @return bool * @throws \Exception */ diff --git a/dist/twist/Core/Utilities/DateTime.utility.php b/dist/twist/Core/Utilities/DateTime.utility.php index a6463821..a6691408 100755 --- a/dist/twist/Core/Utilities/DateTime.utility.php +++ b/dist/twist/Core/Utilities/DateTime.utility.php @@ -73,9 +73,9 @@ public function time(){ * @related time * @reference http://php.net/manual/en/function.date.php * - * @param $strFormat Format the datetime (using PHP date format notation) - * @param $intTimestamp Provide a custom timestamp to process the date - * @return date Returns the date as a string + * @param string $strFormat Format the datetime (using PHP date format notation) + * @param integer $intTimestamp Provide a custom timestamp to process the date + * @return string Returns the date as a string */ public function date($strFormat = 'Y-m-d H:i:s',$intTimestamp = null){ @@ -91,12 +91,11 @@ public function date($strFormat = 'Y-m-d H:i:s',$intTimestamp = null){ * * @related inPast * - * @param $intTimestamp Timestamp for comparison + * @param integer $intTimestamp Timestamp for comparison * @return boolean Returns true if future timestamp */ public function inFuture($intTimestamp){ - $intSecondsDifference = $this->time() - $intTimestamp; - return $intSecondsDifference < 0; + return $this->time() - $intTimestamp < 0; } /** @@ -104,12 +103,11 @@ public function inFuture($intTimestamp){ * * @related inFuture * - * @param $intTimestamp Timestamp for comparison + * @param integer $intTimestamp Timestamp for comparison * @return boolean Returns true if past timestamp */ public function inPast($intTimestamp){ - $intSecondsDifference = $this->time() - $intTimestamp; - return $intSecondsDifference > 0; + return $this->time() - $intTimestamp > 0; } /** @@ -117,13 +115,11 @@ public function inPast($intTimestamp){ * * @related prettyTime * - * @param $intTimestamp Timestamp for conversion + * @param integer $intTimestamp Timestamp for conversion * @return string Returns a formatted human readable time */ public function prettyAge($intTimestamp){ - $strOut = ''; - //Convert date stings into seconds if required if(!is_int($intTimestamp)){ $intTimestamp = strtotime($intTimestamp); @@ -167,8 +163,8 @@ public function prettyAge($intTimestamp){ * * @related prettyAge * - * @param $intSeconds Time in seconds for conversion - * @param $blShortLabels Use short labels (y, mo, w) rather than full labels (year, month, week) + * @param integer $intSeconds Time in seconds for conversion + * @param bool $blShortLabels Use short labels (y, mo, w) rather than full labels (year, month, week) * @return string */ public function prettyTime($intSeconds,$blShortLabels = false){ @@ -219,27 +215,36 @@ public function prettyTime($intSeconds,$blShortLabels = false){ /** * @alias prettyAge + * @param $intTimestamp + * @return string */ public function getAge($intTimestamp){ return $this->prettyAge($intTimestamp); } /** * @alias prettyTime + * @param $intTimestamp + * @return string */ public function getTimePeriod($intTimestamp){ return $this->prettyTime($intTimestamp); } /** * Get the age of a person in years from their date of birth * - * @param $dateDOB Date of birth as a date string + * @param string $dateDOB Date of birth as a date string * @return integer Returns age in years */ public function getPersonAge($dateDOB){ + //Get the timestamp of the DOB $intDOB = strtotime($dateDOB); + //Get the year of the DOB $intYearBorn = date('Y',$intDOB); + //Get the month of the DOB $intMonthBorn = date('m',$intDOB); + //Get the day of the DOB $intDayBorn = date('d',$intDOB); + //Get the number of years since the DOB $intAgeYears = date('Y') - $intYearBorn; if(date('m') < $intMonthBorn){ @@ -256,9 +261,9 @@ public function getPersonAge($dateDOB){ /** * Get an array of every X day between two given dates * - * @param $dateStart Start date of the range - * @param $dateEnd End date of the range - * @param $intWeekdayNumber + * @param string $dateStart Start date of the range + * @param string $dateEnd End date of the range + * @param integer $intWeekdayNumber * @return array Returns and array of dates */ public function getDayBetweenDates($dateStart, $dateEnd, $intWeekdayNumber){ diff --git a/dist/twist/Core/Utilities/FTP.utility.php b/dist/twist/Core/Utilities/FTP.utility.php index bf2fc2a6..3c32e863 100755 --- a/dist/twist/Core/Utilities/FTP.utility.php +++ b/dist/twist/Core/Utilities/FTP.utility.php @@ -47,7 +47,7 @@ public function __construct(){ /** * Connect to the remote FTP server - * @param $strHost + * @param string $strHost * @param int $intPort * @param null|int $intConnectionTimeout */ @@ -68,8 +68,8 @@ public function disconnect(){ /** * Login to the open FTP connection - * @param $strUsername - * @param $strPassword + * @param string $strUsername + * @param string $strPassword * @return bool */ public function login($strUsername,$strPassword){ @@ -102,7 +102,7 @@ public function featureList(){ /** * Detect if the connected FTP server supports this feature - * @param $strFeature Name of feature to check + * @param string $strFeature Name of feature to check * @return bool */ public function featureSupported($strFeature){ @@ -121,7 +121,7 @@ public function getCurrentDirectory(){ /** * Change the current working directory to a new location * - * @param $strDirectory Path of new working directory + * @param string $strDirectory Path of new working directory * @return bool Returns the status of change */ public function changeDirectory($strDirectory){ @@ -131,7 +131,7 @@ public function changeDirectory($strDirectory){ /** * Detect if the directory exists and is a directory * - * @param $strDirectory Path of directory + * @param string $strDirectory Path of directory * @return bool Returns the status of directory */ public function isDirectory($strDirectory){ @@ -141,7 +141,7 @@ public function isDirectory($strDirectory){ /** * Make a new directory on the remote FTP server * - * @param $strDirectory Path for the new directory + * @param string $strDirectory Path for the new directory * @return bool Returns the status of directory creation */ public function makeDirectory($strDirectory,$blRecursive = false){ @@ -169,7 +169,7 @@ public function makeDirectory($strDirectory,$blRecursive = false){ /** * Remove a directory on the remote FTP server * - * @param $strDirectory Path of the directory to remove + * @param string $strDirectory Path of the directory to remove * @return bool Returns the status of the removal */ public function removeDirectory($strDirectory,$blRecursive = false){ @@ -201,7 +201,7 @@ public function removeDirectory($strDirectory,$blRecursive = false){ /** * List the provided directory and return as an array * - * @param $strDirectory + * @param string $strDirectory * @return array|bool */ public function listDirectory($strDirectory){ @@ -211,8 +211,8 @@ public function listDirectory($strDirectory){ /** * Rename either a file or directory to a new name * - * @param $strFilename - * @param $strNewFilename + * @param string $strFilename + * @param string $strNewFilename * @return bool */ public function rename($strFilename, $strNewFilename){ @@ -222,8 +222,8 @@ public function rename($strFilename, $strNewFilename){ /** * Upload a file to the remote FTP server * - * @param $strLocalFilename - * @param $strRemoteFilename + * @param string $strLocalFilename + * @param string $strRemoteFilename * @param string $strMode * @return bool */ @@ -234,8 +234,8 @@ public function upload($strLocalFilename, $strRemoteFilename, $strMode = 'A'){ /** * Download a file from the remote FTP server * - * @param $strRemoteFilename - * @param $strLocalFilename + * @param string $strRemoteFilename + * @param string $strLocalFilename * @param string $strMode * @return bool */ @@ -246,7 +246,7 @@ public function download($strRemoteFilename, $strLocalFilename, $strMode = 'A'){ /** * Remove the file from the server * - * @param $strFilename + * @param string $strFilename * @return bool */ public function delete($strFilename){ @@ -256,8 +256,8 @@ public function delete($strFilename){ /** * CHMOD the files permissions * - * @param $strFilename - * @param $intMode + * @param string $strFilename + * @param integer $intMode * @return bool */ public function chmod($strFilename,$intMode){ @@ -267,7 +267,7 @@ public function chmod($strFilename,$intMode){ /** * Get the size of any given file on the remote FTP server * - * @param $strFilename + * @param string $strFilename * @return bool|int */ public function size($strFilename){ @@ -277,7 +277,7 @@ public function size($strFilename){ /** * Get the last modified time of any given file on the remote FTP server * - * @param $strFilename + * @param string $strFilename * @return bool|int */ public function modified($strFilename){ diff --git a/dist/twist/Core/Utilities/File.utility.php b/dist/twist/Core/Utilities/File.utility.php index 0a5a9027..e0a1162b 100755 --- a/dist/twist/Core/Utilities/File.utility.php +++ b/dist/twist/Core/Utilities/File.utility.php @@ -62,7 +62,7 @@ public function writeDelayedFiles(){ /** * Convert bytes to a human readable size for example 1536 would be converted to 1.5KB * - * @param $intBytes Size in bytes + * @param integer $intBytes Size in bytes * @return mixed Returns a human readable data size */ public function bytesToSize($intBytes){ @@ -107,8 +107,8 @@ public function bytesToSize($intBytes){ /** * Sanitize a file name to make it more user friendly. Also helps to prevent errors and make a much cleaner file system. * - * @param $strFilename Name to be sanitized - * @param $blIsFilename Set to true will allow '~' and '.' in file names + * @param string $strFilename Name to be sanitized + * @param bool $blIsFilename Set to true will allow '~' and '.' in file names * @return string Returns the sanitized file name */ public function sanitizeName($strFilename, $blIsFilename = true){ @@ -129,7 +129,7 @@ public function sanitizeName($strFilename, $blIsFilename = true){ /** * Get the file extension of any file, provide the file or its full path. * - * @param $strFilePath File name/path + * @param string $strFilePath File name/path * @return string Returns the file extension */ public function extension($strFilePath){ @@ -147,7 +147,7 @@ public function extension($strFilePath){ /** * Get the filename, trim off any path information that is not required. * - * @param $strFile Full path to file including file name + * @param string $strFile Full path to file including file name * @return string Returns the file name only */ public function name($strFile){ @@ -163,8 +163,8 @@ public function name($strFile){ /** * Get the mime type of a file by its file extension. * - * @param $dirFile Full path to file including file name - * @param $blReturnDefaultOnly If multiple types available return as array + * @param string $dirFile Full path to file including file name + * @param bool $blReturnDefaultOnly If multiple types available return as array * @return string Returns the content type */ public function mimeType($dirFile,$blReturnDefaultOnly = true){ @@ -188,7 +188,7 @@ public function mimeType($dirFile,$blReturnDefaultOnly = true){ /** * Get file details by path or extension - * @param $dirFile + * @param string $dirFile * @return array */ public function mimeTypeInfo($dirFile){ @@ -221,9 +221,9 @@ public function mimeTypes($strType = null){ /** * Find a file in a directory when there is multiple of the same file with many different version numbers. * - * @param $strDirectory Path of directory to search - * @param $strFilePrefix File prefix to help filter correct files - * @param $strVersion Version of file to find + * @param string $strDirectory Path of directory to search + * @param string $strFilePrefix File prefix to help filter correct files + * @param string $strVersion Version of file to find * @return string Returns file name of verion file */ public function findVersion($strDirectory,$strFilePrefix,$strVersion = null){ @@ -278,12 +278,12 @@ public function findVersion($strDirectory,$strFilePrefix,$strVersion = null){ /** * Serve any local file to the user to be downloaded. Mime type, Max Cache Time and Restricted Download Speed in KB are all optional * - * @param $strFile Full path of file to be served - * @param $strServeAsName Serve the file as the name provided - * @param $strMimeType Mime type to serve file as - * @param $intMaxCacheTime Set to the max cache time in seconds - * @param $intMaxTransferRate Set to the Max transfer rate in kb/s - * @param $blDeleteFile Remove the file after serve, use this when serving a temp file + * @param string $strFile Full path of file to be served + * @param string $strServeAsName Serve the file as the name provided + * @param string $strMimeType Mime type to serve file as + * @param integer $intMaxCacheTime Set to the max cache time in seconds + * @param integer $intMaxTransferRate Set to the Max transfer rate in kb/s + * @param bool $blDeleteFile Remove the file after serve, use this when serving a temp file */ public function serve($strFile,$strServeAsName=null,$strMimeType=null,$intMaxCacheTime=null,$intMaxTransferRate=null,$blDeleteFile=false){ @@ -393,8 +393,8 @@ public function serve($strFile,$strServeAsName=null,$strMimeType=null,$intMaxCac * Handle uploaded files, call the function and pass in the html file input name. The file will then be uploaded to the system ready to be processed. * Optionally pass in a UID so that you can reference the temp file to further process the file, can be useful if uploading a file before the user has submitted the form. * - * @param $strFileKey Key for the file in the $_FILES array - * @param $strUID Unique ID used to reference the file after upload + * @param string $strFileKey Key for the file in the $_FILES array + * @param string $strUID Unique ID used to reference the file after upload * @return array Returns an array of information for the uploaded file */ public function upload($strFileKey,$strUID = null){ @@ -517,8 +517,8 @@ public function uploadPUT(){ /** * Download/Copy a remote file over HTTP in chunks, outputting the chunks direclty to a local file handler. Download large files to the server without running out of system memory. - * @param $strRemoteFile Full URL to the remote file - * @param $strLocalFile Local path where the file is to be saved + * @param string $strRemoteFile Full URL to the remote file + * @param string $strLocalFile Local path where the file is to be saved * @return bool|int Total bytes downloaded, false upon failure */ public function download($strRemoteFile, $strLocalFile){ @@ -598,8 +598,8 @@ public function download($strRemoteFile, $strLocalFile){ * Basic alias function of PHP's hash_file, hash a file on the local server * * @reference http://php.net/manual/en/function.hash-file.php - * @param $strFilePath Path to the file - * @param $strHashAlgorithm Set the hash algorithm 'md5' or 'sha1' + * @param string $strFilePath Path to the file + * @param string $strHashAlgorithm Set the hash algorithm 'md5' or 'sha1' * @return string Returns a hash of the file */ public function hash($strFilePath, $strHashAlgorithm='md5'){ @@ -610,8 +610,8 @@ public function hash($strFilePath, $strHashAlgorithm='md5'){ * Get a unique Hash of a directory in MD5 or SHA1. If any single item within the directory or sub-directories changes the unique hash will change as well. * * @related hash - * @param $dirPath Path of the directory - * @param $strHashAlgorithm Set the hash algorithm 'md5' or 'sha1' + * @param string $dirPath Path of the directory + * @param string $strHashAlgorithm Set the hash algorithm 'md5' or 'sha1' * @return bool|string */ public function directoryHash($dirPath, $strHashAlgorithm='md5'){ @@ -642,8 +642,8 @@ public function directoryHash($dirPath, $strHashAlgorithm='md5'){ /** * Get the full size in bytes of any directory by providing its full path. Optional parameter to format the return data in a human readable format. * - * @param $dirPath Path of the directory - * @param $blFormatOutput Set 'true' to format output + * @param string $dirPath Path of the directory + * @param bool $blFormatOutput Set 'true' to format output * @return mixed Returns the size in bytes or a human readable format */ public function directorySize($dirPath, $blFormatOutput=false){ @@ -671,7 +671,7 @@ public function directorySize($dirPath, $blFormatOutput=false){ /** * Check to see if a file exists, this also checks delayed files by default - * @param $dirFilePath + * @param string $dirFilePath * @param bool $blCheckDelayedFiles * @return bool */ @@ -736,6 +736,7 @@ public function read($dirFilePath,$intBytesStart = 0,$intBytesEnd = null,$blChec * @param mixed $mxdData Data to be stored in the file * @param null $strOptions pass in either null, prefix or suffix * @param bool $blDelayedWrite Store file in memory and write to disk after script has finished + * @throws \Exception */ public function write($dirFilePath,$mxdData,$strOptions = null,$blDelayedWrite = false){ @@ -779,8 +780,8 @@ public function write($dirFilePath,$mxdData,$strOptions = null,$blDelayedWrite = * Basic alias function of PHP's unlink, removes a file or symlink from the local server * * @reference http://php.net/manual/en/function.unlink.php - * @param $strFilePath Path of the file to be removed - * @param $blIncludeDelayedFiles + * @param string $dirFilePath Path of the file to be removed + * @param bool $blIncludeDelayedFiles * @return bool Return the status of the removal */ public function remove($dirFilePath,$blIncludeDelayedFiles = true){ @@ -794,6 +795,9 @@ public function remove($dirFilePath,$blIncludeDelayedFiles = true){ /** * @alias remove + * @param string $strFilePath + * @param bool $blIncludeDelayedFiles + * @return bool */ public function delete($strFilePath,$blIncludeDelayedFiles = true){ return $this->remove($strFilePath,$blIncludeDelayedFiles); } @@ -801,7 +805,7 @@ public function delete($strFilePath,$blIncludeDelayedFiles = true){ return $this * Recursively remove a directory and all its files and sub directories on the local server * * @related remove - * @param $strDirectory Path of the directory to be removed + * @param string $strDirectory Path of the directory to be removed */ public function recursiveRemove($strDirectory){ @@ -826,8 +830,8 @@ public function recursiveRemove($strDirectory){ * Basic alias function of PHP's rename, move/rename a file on the local server * * @reference http://php.net/manual/en/function.rename.php - * @param $strSourcePath Path of file to be moved - * @param $strDestinationPath Destination path and name for moved file + * @param string $strSourcePath Path of file to be moved + * @param string $strDestinationPath Destination path and name for moved file * @return bool Returns the status of the move */ public function move($strSourcePath, $strDestinationPath){ @@ -838,8 +842,8 @@ public function move($strSourcePath, $strDestinationPath){ * Basic alias function of PHP's copy, copy a file on the local server * * @reference http://php.net/manual/en/function.copy.php - * @param $strSourcePath Path of file to be copied - * @param $strDestinationPath Destination path and name for copied file + * @param string $strSourcePath Path of file to be copied + * @param string $strDestinationPath Destination path and name for copied file * @return bool Returns the status of the copied */ public function copy($strSourcePath,$strDestinationPath){ @@ -850,8 +854,8 @@ public function copy($strSourcePath,$strDestinationPath){ * Recursively copy a directory and all its files and sub-directories to a new location on the local server * * @related copy - * @param $strSource - * @param $strDestination + * @param string $strSourcePath + * @param string $strDestinationPath */ public function recursiveCopy($strSourcePath,$strDestinationPath){ @@ -879,7 +883,7 @@ public function recursiveCopy($strSourcePath,$strDestinationPath){ /** * Recursively create a directory on the local server * - * @param $strDirectoryPath New directory path + * @param string $strDirectoryPath New directory path * @return boolean Returns that status of the new directory */ public function recursiveCreate($strDirectoryPath){ @@ -926,7 +930,8 @@ public function recursiveCreate($strDirectoryPath){ * multiple = 0 * id = uniqid() * - * @param $strReference + * @param string $strReference + * @param array $arrParameters * @return string */ public function viewExtension($strReference,$arrParameters = array()){ diff --git a/dist/twist/Core/Utilities/Framework.utility.php b/dist/twist/Core/Utilities/Framework.utility.php index f1de8d51..ca238f23 100755 --- a/dist/twist/Core/Utilities/Framework.utility.php +++ b/dist/twist/Core/Utilities/Framework.utility.php @@ -88,7 +88,7 @@ public function register(){ /** * Get or set a single setting by its key, pass in a value (2nd parameter to set/store the value against the key). - * @param $strKey + * @param string $strKey * @param null $strValue * @return bool|null */ diff --git a/dist/twist/Core/Utilities/ICS.utility.php b/dist/twist/Core/Utilities/ICS.utility.php index 672ea181..20091bab 100755 --- a/dist/twist/Core/Utilities/ICS.utility.php +++ b/dist/twist/Core/Utilities/ICS.utility.php @@ -54,7 +54,7 @@ public function createEvent(){ /** * Load in an existing ICS file in to be converted into an usable ICS Event/Calendar object * - * @param $dirICSFile Path of the ICS file to be imported + * @param string $dirICSFile Path of the ICS file to be imported * @return null|\Twist\Core\Models\ICS\Event|\Twist\Core\Models\ICS\Calendar Returns NULL or either the ICS Event or Calendar Object */ public function loadFile($dirICSFile){ @@ -72,7 +72,7 @@ public function loadFile($dirICSFile){ /** * Turns the raw ICS data into an object and returns * - * @param $strRawData + * @param string $strRawData * @return null|\Twist\Core\Models\ICS\Event|\Twist\Core\Models\ICS\Calendar Returns NULL or either the ICS Event or Calendar Object */ protected function parseRawData($strRawData){ @@ -125,7 +125,7 @@ protected function parseRawData($strRawData){ $mxdValue = implode($strExplodeChar,$arrRowParts); //Set the data into the event or calendar - $resCurrentItem->setData($strKey,$mxdValue); + $resCurrentItem->setData($strKey,$mxdValue); //TODO: Isn't defined? break; } } diff --git a/dist/twist/Core/Utilities/Image.utility.php b/dist/twist/Core/Utilities/Image.utility.php index 5e8cbca2..05912875 100755 --- a/dist/twist/Core/Utilities/Image.utility.php +++ b/dist/twist/Core/Utilities/Image.utility.php @@ -48,7 +48,7 @@ public function __construct(){ * Load an existing image, and Image object will be produced allowing complete control over the image. * Once all changes have been made you can then export the image as a file or serve to the screen. * - * @param $mxdImage + * @param mixed $mxdImage * @return \Twist\Core\Models\Image\Image Returns an object of the loaded Image */ public function load($mxdImage){ @@ -59,9 +59,9 @@ public function load($mxdImage){ * Create a new image from scratch, and Image object will be produced allowing complete control over the image. * Once all changes have been made you can then export the image as a file or serve to the screen. * - * @param $intWidth - * @param $intHeight - * @param $strFillColour + * @param integer $intWidth + * @param integer $intHeight + * @param string $strFillColour * @return \Twist\Core\Models\Image\Image Returns an object of the new Image */ public function create($intWidth,$intHeight,$strFillColour){ diff --git a/dist/twist/Core/Utilities/Localisation.utility.php b/dist/twist/Core/Utilities/Localisation.utility.php index 6f64427c..f7ffa17f 100755 --- a/dist/twist/Core/Utilities/Localisation.utility.php +++ b/dist/twist/Core/Utilities/Localisation.utility.php @@ -75,7 +75,7 @@ public function __construct(){ /** * Get a single-dimensional array of language information related to the provided 2 Character ISO language code. * - * @param $strLanguageISO 2 Character ISO code + * @param string $strLanguageISO 2 Character ISO code * @return array Returns a single-dimensional language array */ public function getLanguage($strLanguageISO){ @@ -87,7 +87,7 @@ public function getLanguage($strLanguageISO){ * Get multi-dimensional array of all languages. Optionally include the localised/native language name. * * @related getLanguage - * @param $blIncludeLocalisation Enable localised/native language name + * @param bool $blIncludeLocalisation Enable localised/native language name * @return array Returns a multi-dimensional array of languages */ public function getLanguages($blIncludeLocalisation = false){ @@ -98,7 +98,7 @@ public function getLanguages($blIncludeLocalisation = false){ * Get the official language of any given country by 2 character ISO country code. * * @related getLanguage - * @param $strCountryISO 2 Character ISO code + * @param string $strCountryISO 2 Character ISO code * @return array Returns an single-dimensional language array */ public function getOfficialLanguage($strCountryISO){ @@ -109,7 +109,7 @@ public function getOfficialLanguage($strCountryISO){ /** * Get a single-dimensional array of country information by its 2 Character ISO country code. * - * @param $strCountryISO 2 Character ISO code + * @param string $strCountryISO 2 Character ISO code * @return array Returns an single-dimensional country array */ public function getCountry($strCountryISO){ @@ -130,7 +130,7 @@ public function getCountries(){ /** * Get a single-dimensional array of currency information by its 3 Character ISO currency code. * - * @param $strCurrencyISO 3 Character ISO code + * @param string $strCurrencyISO 3 Character ISO code * @return array Returns an single-dimensional country array */ public function getCurrency($strCurrencyISO){ @@ -150,7 +150,7 @@ public function getCurrencies(){ * Get the official currency of any given country by 2 character ISO country code. * * @related getCurrency - * @param $strCountryISO 2 Character ISO code + * @param string $strCountryISO 2 Character ISO code * @return array Returns an single-dimensional language array */ public function getOfficialCurrency($strCountryISO){ @@ -161,7 +161,7 @@ public function getOfficialCurrency($strCountryISO){ /** * Get a single-dimensional array of timezone information related to the provided timezone code. * - * @param $strTimezoneCode Timezone code i.e 'Europe/London' + * @param string $strTimezoneCode Timezone code i.e 'Europe/London' * @return array Returns a single-dimensional language array */ public function getTimezone($strTimezoneCode){ @@ -181,8 +181,8 @@ public function getTimezones(){ /** * Convert an amount between two Currency ISO codes - * @param $strFromISO - * @param $strToISO + * @param string $strFromISO + * @param string $strToISO * @param $fltAmount * @param bool $blFormat * @return string @@ -198,8 +198,8 @@ public function convertCurrency($strFromISO,$strToISO,$fltAmount,$blFormat = tru /** * Get the conversion rate between two provided currency ISO codes. - * @param $strFromISO - * @param $strToISO + * @param string $strFromISO + * @param string $strToISO * @return \SimpleXMLElement * @throws \Exception */ @@ -213,7 +213,7 @@ public function currencyConversionRate($strFromISO,$strToISO){ //Yahoo Currency API $arrParameters = array( - 'q' => sprintf('select * from yahoo.finance.xchange where pair in ("%s%s")',$strFromISO,$strToISO), + 'q' => sprintf('SELECT * FROM yahoo.finance.xchange WHERE pair IN ("%s%s")',$strFromISO,$strToISO), 'format' => 'json', 'env' => 'store://datatables.org/alltableswithkeys', ); diff --git a/dist/twist/Core/Utilities/Route.utility.php b/dist/twist/Core/Utilities/Route.utility.php index fbab7b65..b6596d83 100755 --- a/dist/twist/Core/Utilities/Route.utility.php +++ b/dist/twist/Core/Utilities/Route.utility.php @@ -112,7 +112,7 @@ public function listeners(){ /** * Set a custom views directory to use for this routes instance, leaving blank will use the default views directory - * @param $dirViewPath Path to the view directory + * @param string $dirViewPath Path to the view directory */ public function setDirectory($dirViewPath = null){ $this->resView->setDirectory($dirViewPath); @@ -120,7 +120,7 @@ public function setDirectory($dirViewPath = null){ /** * Set a custom controller directory to use for this routes instance, leaving blank will use the default controllers directory - * @param $dirControllerPath Path to the controller directory + * @param string $dirControllerPath Path to the controller directory */ public function setControllerDirectory($dirControllerPath = null){ $this->strControllerDirectory = rtrim($dirControllerPath,'/'); @@ -128,7 +128,8 @@ public function setControllerDirectory($dirControllerPath = null){ /** * Set a path to the base view that you wish to wrap the output of the route with - * @param $dirViewFile Path to the base view file, relative to your view directory (a full path can be used if required) + * @param string $dirViewFile Path to the base view file, relative to your view directory (a full path can be used if required) + * @return null|string */ public function baseView($dirViewFile = null){ @@ -142,7 +143,8 @@ public function baseView($dirViewFile = null){ /** * Set a base URI so that you can use routes in folders that are not your Doc Root - * @param $strBaseURI + * @param string $strBaseURI + * @return null|string */ public function baseURI($strBaseURI = null){ @@ -159,7 +161,8 @@ public function baseURI($strBaseURI = null){ /** * Set/Get the package URI, used only when creating or working with an framework interface - * @param $strInterface + * @param string $strPackage + * @return null|string */ public function packageURI($strPackage = null){ @@ -188,6 +191,7 @@ public function baseViewForce(){ /** * Enable debug mode, this will override the debug/development settings in Twist Settings + * @param bool $blEnabled */ public function debugMode($blEnabled = true){ $this->blDebugMode = $blEnabled; @@ -195,7 +199,7 @@ public function debugMode($blEnabled = true){ /** * Allow the route to bypass maintenance mode when maintenance mode is enabled - * @param $strURI URI of the route to allow + * @param string $strURI URI of the route to allow */ public function bypassMaintenanceMode($strURI){ @@ -223,6 +227,7 @@ public function model(){ /** * Get all the registered routes and return as an array + * @return array */ public function getAll(){ @@ -259,6 +264,7 @@ public function getRestrictions(){ /** * Set the page title for the page (can be called during the processing of the page) + * @param string $strPageTitle */ public function pageTitle($strPageTitle){ $this->strPageTitle = $strPageTitle; @@ -295,9 +301,9 @@ protected function _restrictDefault($strURI,$strLoginURI){ * Restrict a page to logged in users only, place a '%' at the end of the URI will apply this restriction to all child pages as well as itself * * @note Restrict a URI without using '%' will only restrict the exact URI provided - * @param $strURI - * @param $strLoginURI - * @param $intLevel By default it restricts page to the lowest possible level (1) + * @param string $strURI + * @param string $strLoginURI + * @param integer $intLevel By default it restricts page to the lowest possible level (1) */ public function restrict($strURI,$strLoginURI,$intLevel = 1){ @@ -307,6 +313,7 @@ public function restrict($strURI,$strLoginURI,$intLevel = 1){ /** * Add an exception to the restrictions applied + * @param string $strURI */ public function unrestrict($strURI){ @@ -325,8 +332,8 @@ public function unrestrict($strURI){ /** * @related restrict * - * @param $strURI - * @param $strLoginURI + * @param string $strURI + * @param string $strLoginURI */ public function restrictMember($strURI,$strLoginURI){ $this->restrict($strURI,$strLoginURI,\Twist::framework()->setting('USER_LEVEL_MEMBER')); @@ -335,8 +342,8 @@ public function restrictMember($strURI,$strLoginURI){ /** * @related restrict * - * @param $strURI - * @param $strLoginURI + * @param string $strURI + * @param string $strLoginURI */ public function restrictAdvanced($strURI,$strLoginURI){ $this->restrict($strURI,$strLoginURI,\Twist::framework()->setting('USER_LEVEL_ADVANCED')); @@ -345,8 +352,8 @@ public function restrictAdvanced($strURI,$strLoginURI){ /** * @related restrict * - * @param $strURI - * @param $strLoginURI + * @param string $strURI + * @param string $strLoginURI */ public function restrictAdmin($strURI,$strLoginURI){ $this->restrict($strURI,$strLoginURI,\Twist::framework()->setting('USER_LEVEL_ADMIN')); @@ -355,8 +362,8 @@ public function restrictAdmin($strURI,$strLoginURI){ /** * @related restrict * - * @param $strURI - * @param $strLoginURI + * @param string $strURI + * @param string $strLoginURI */ public function restrictSuperAdmin($strURI,$strLoginURI){ $this->restrict($strURI,$strLoginURI,\Twist::framework()->setting('USER_LEVEL_SUPERADMIN')); @@ -365,8 +372,8 @@ public function restrictSuperAdmin($strURI,$strLoginURI){ /** * @related restrict * - * @param $strURI - * @param $strLoginURI + * @param string $strURI + * @param string $strLoginURI */ public function restrictRoot($strURI,$strLoginURI){ $this->restrict($strURI,$strLoginURI,0); @@ -375,9 +382,9 @@ public function restrictRoot($strURI,$strLoginURI){ /** * @related restrict * - * @param $strURI - * @param $strLoginURI - * @param $strGroupSlug + * @param string $strURI + * @param string $strLoginURI + * @param string $strGroupSlug */ public function restrictGroup($strURI,$strLoginURI,$strGroupSlug){ @@ -398,8 +405,8 @@ public function restrictGroup($strURI,$strLoginURI,$strGroupSlug){ /** * Serve a file form a particular route, you can change the name of the file upon download and restrict the download bandwidth (very helpful if you have limited bandwidth) * - * @param $strURI - * @param $dirFilePath Full path to the file that will be served + * @param string $strURI + * @param string $dirFilePath Full path to the file that will be served * @param null $strServeName Name of the file to be served * @param null $intLimitDownloadSpeed Download speed for the end user in KB */ @@ -411,8 +418,8 @@ public function file($strURI,$dirFilePath,$strServeName = null,$intLimitDownload * Serve all contents of a folder on a virtual route, the folder begin served dose not need to be publicly accessible, * also restriction can be applied to the virtual route if user login is required to access. * - * @param $strURI - * @param $dirFolderPath Full path to the folder to be served + * @param string $strURI + * @param string $dirFolderPath Full path to the folder to be served * @param bool $blForceDownload Force the file to be downloaded to be browser * @param null $intLimitDownloadSpeed Download speed for the end user in KB */ @@ -424,8 +431,8 @@ public function folder($strURI,$dirFolderPath,$blForceDownload = false,$intLimit * Add a controller that will be called upon a any request (HTTP METHOD) to the given URI. * The URI can be made dynamic by adding a '%' symbol at the end. * - * @param $strURI - * @param $mxdController + * @param string $strURI + * @param mixed $mxdController * @param bool $mxdBaseView * @param bool $mxdCache * @param array $arrData @@ -439,7 +446,7 @@ public function controller($strURI,$mxdController,$mxdBaseView = true,$mxdCache * Add a ajax server that will be called upon a any request (HTTP METHOD) to the given URI. * The URI can be made dynamic by adding a '%' symbol at the end. * - * @param $strURI + * @param string $strURI * @param null $mxdController */ public function ajax($strURI,$mxdController){ @@ -451,8 +458,8 @@ public function ajax($strURI,$mxdController){ * Add a pre-defined package route (interface) (provided by installed packages) that will be called upon a any request (HTTP METHOD) to the given URI. * The URI can be made dynamic by adding a '%' symbol at the end. * - * @param $strURI - * @param $strPackage + * @param string $strURI + * @param string $strPackage * @param bool $mxdBaseView * @param bool $mxdCache * @param array $arrData @@ -465,9 +472,9 @@ public function package($strURI,$strPackage,$mxdBaseView = true,$mxdCache = fals * Add a redirect that will be called upon a any request (HTTP METHOD) to the given URI. * The URI can be made dynamic by adding a '%' symbol at the end. * - * @param $strURI - * @param $strURL - * @param $blPermanent + * @param string $strURI + * @param string $strURL + * @param bool $blPermanent */ public function redirect($strURI,$strURL,$blPermanent = false){ $this->addRoute($strURI,($blPermanent) ? 'redirect-permanent' : 'redirect',$strURL); @@ -477,8 +484,8 @@ public function redirect($strURI,$strURL,$blPermanent = false){ * Add a view that will be called upon a any request (HTTP METHOD) to the given URI, using this call will not take precedence over a GET,POST,PUT or DELETE route. * The URI can be made dynamic by adding a '%' symbol at the end. * - * @param $strURI - * @param $dirView + * @param string $strURI + * @param string $dirView * @param bool $mxdBaseView * @param bool $mxdCache * @param array $arrData @@ -492,8 +499,8 @@ public function view($strURI,$dirView,$mxdBaseView = true,$mxdCache = false,$arr * * @related view * - * @param $strURI - * @param $dirView + * @param string $strURI + * @param string $dirView * @param bool $mxdBaseView * @param bool $mxdCache * @param array $arrData @@ -507,8 +514,8 @@ public function getView($strURI,$dirView,$mxdBaseView = true,$mxdCache = false,$ * * @related view * - * @param $strURI - * @param $dirView + * @param string $strURI + * @param string $dirView * @param bool $mxdBaseView * @param bool $mxdCache * @param array $arrData @@ -522,8 +529,8 @@ public function postView($strURI,$dirView,$mxdBaseView = true,$mxdCache = false, * * @related view * - * @param $strURI - * @param $dirView + * @param string $strURI + * @param string $dirView * @param bool $mxdBaseView * @param bool $mxdCache * @param array $arrData @@ -537,8 +544,8 @@ public function putView($strURI,$dirView,$mxdBaseView = true,$mxdCache = false,$ * * @related view * - * @param $strURI - * @param $dirView + * @param string $strURI + * @param string $dirView * @param bool $mxdBaseView * @param bool $mxdCache * @param array $arrData @@ -549,7 +556,7 @@ public function deleteView($strURI,$dirView,$mxdBaseView = true,$mxdCache = fals /** * Pass in a PHP function to be parsed by the route - * @param $strURI + * @param string $strURI * @param $resFunction * @param bool $mxdBaseView */ @@ -559,7 +566,7 @@ public function any($strURI,$resFunction,$mxdBaseView = true){ /** * Pass in a PHP function to be parsed by the route upon a GET request - * @param $strURI + * @param string $strURI * @param $resFunction * @param bool $mxdBaseView */ @@ -569,7 +576,7 @@ public function get($strURI,$resFunction,$mxdBaseView = true){ /** * Pass in a PHP function to be parsed by the route upon a POST request - * @param $strURI + * @param string $strURI * @param $resFunction * @param bool $mxdBaseView */ @@ -579,8 +586,8 @@ public function post($strURI,$resFunction,$mxdBaseView = true){ /** * Pass in a PHP function to be parsed by the route upon a PUT request - * @param $strURI - * @param $resFunction + * @param string $strURI + * @param string $resFunction * @param bool $mxdBaseView */ public function put($strURI,$resFunction,$mxdBaseView = true){ @@ -589,8 +596,8 @@ public function put($strURI,$resFunction,$mxdBaseView = true){ /** * Pass in a PHP function to be parsed by the route upon a DELETE request - * @param $strURI - * @param $resFunction + * @param string $strURI + * @param string $resFunction * @param bool $mxdBaseView */ public function delete($strURI,$resFunction,$mxdBaseView = true){ @@ -599,14 +606,17 @@ public function delete($strURI,$resFunction,$mxdBaseView = true){ /** * Add the route into the array of listeners, when the serve function if called the listeners array will be processed and a page will be served - * - * @param $strURI - * @param $strType - * @param $strItem - * @param $arrData - * @param bool $mxdCache + +* +*@param string $strURI + * @param string $strType + * @param string $strItem + * @param bool $blBaseView + * @param bool $blCache + * @param array $arrData + * @param null $strRequestMethod */ - protected function addRoute($strURI,$strType,$strItem,$mxdBaseView=true,$mxdCache=false,$arrData=array(),$strRequestMethod = null){ + protected function addRoute($strURI,$strType,$strItem,$blBaseView = true, $blCache=false,$arrData=array(),$strRequestMethod = null){ $blWildCard = false; if(substr($strURI,-1) == '%' || $strType == 'package'){ @@ -658,11 +668,11 @@ protected function addRoute($strURI,$strType,$strItem,$mxdBaseView=true,$mxdCach 'item' => $strItem, 'data' => $arrData, 'model' => $strModel, - 'base_view' => $mxdBaseView, + 'base_view' => $blBaseView, 'wildcard' => $blWildCard, - 'cache' => ($mxdCache === false) ? false : true, + 'cache' => ( $blCache === false) ? false : true, 'cache_key' => null, - 'cache_life' => ($mxdCache === true) ? $this->intCacheTime : ($mxdCache !== false) ? $mxdCache : 0 + 'cache_life' => ( $blCache === true) ? $this->intCacheTime : ( $blCache !== false) ? $blCache : 0 ); if(!\Twist::framework()->setting('ROUTE_CASE_SENSITIVE')){ @@ -713,7 +723,7 @@ protected function processRoutes(){ /** * Process the routes Array by reference and adding in the current set baseURI - * @param $arrRoutesDataRef + * @param array $arrRoutesDataRef */ protected function processRoutesArray(&$arrRoutesDataRef){ @@ -736,7 +746,7 @@ protected function processRoutesArray(&$arrRoutesDataRef){ /** * Load an existing page form the page cache, use the page key to find the cached page. - * @param $strPageCacheKey + * @param string $strPageCacheKey */ protected function loadPageCache($strPageCacheKey){ @@ -777,9 +787,9 @@ protected function loadPageCache($strPageCacheKey){ /** * Store a page into the page cache, use a unique page key so that the page can be found again later when required. - * @param $strPageCacheKey - * @param $strPageData - * @param $intCacheTime + * @param string $strPageCacheKey + * @param string $strPageData + * @param integer $intCacheTime */ protected function storePageCache($strPageCacheKey,$strPageData,$intCacheTime = 3600){ @@ -828,6 +838,7 @@ protected function currentMethodRoutes(){ * Detect the current active route from the users URI, uses the PHP variable $_SERVER['REQUEST_URI'] to achieve this. * Wild card detection is also carried out here if you are on a wild carded domain. * + * @param string $strReturnKey * @return array Returns an array of data relating to the current route */ public function current($strReturnKey = null){ @@ -921,7 +932,7 @@ public function current($strReturnKey = null){ $arrRouteParts = (!in_array(trim($strRouteDynamic,'/'),array('','/'))) ? explode('/',trim($strRouteDynamic,'/')) : array(); $strCurrentURI = $strCurrentURIKey = $strWildCard; - $blMatched = true; + $blMatched = true; //TODO: Remove? } } } @@ -1243,8 +1254,8 @@ public function processController($arrRoute){ /** * Check to see if a URI is present in an array od URIs, the key must be the URI and the value can either be 1 (denotes wildcard check enabled) or 0 (no wildcard check) - * @param $arrURIs - * @param $strCurrentURI + * @param array $arrURIs + * @param string $strCurrentURI * @return bool */ protected function findURI($arrURIs,$strCurrentURI){ @@ -1268,7 +1279,7 @@ protected function findURI($arrURIs,$strCurrentURI){ /** * Serve is used to active the routes system after all routes have been set - * @param $blExitOnComplete Exit script once the page has been served + * @param bool $blExitOnComplete Exit script once the page has been served * @throws \Exception */ public function serve($blExitOnComplete = true){ diff --git a/dist/twist/Core/Utilities/Session.utility.php b/dist/twist/Core/Utilities/Session.utility.php index d127285f..16586d45 100755 --- a/dist/twist/Core/Utilities/Session.utility.php +++ b/dist/twist/Core/Utilities/Session.utility.php @@ -147,6 +147,7 @@ public function delete($strKey = null){ /** * @alias delete + * @param string $strKey */ public function remove($strKey = null){ $this->delete($strKey); @@ -154,7 +155,6 @@ public function remove($strKey = null){ /** * @param string $strReference - * @return mixed|null|string */ public function viewExtension($strReference){ diff --git a/dist/twist/Core/Utilities/Timer.utility.php b/dist/twist/Core/Utilities/Timer.utility.php index 38294537..45d5e11f 100755 --- a/dist/twist/Core/Utilities/Timer.utility.php +++ b/dist/twist/Core/Utilities/Timer.utility.php @@ -45,7 +45,7 @@ protected function getMicroTime($strCustomStart = null){ /** * Start a new timer, pass in a unique key to reference the timer with - * @param $intStartMicroTime Start time to use if not current time + * @param integer $intStartMicroTime Start time to use if not current time */ public function start($intStartMicroTime = null){ $this->arrTimer = array( @@ -65,7 +65,6 @@ public function start($intStartMicroTime = null){ /** * Stop the timer, this timer cannot that be used any further - * @param $strReference * @return mixed */ public function stop(){ @@ -83,7 +82,6 @@ public function stop(){ /** * Clear the timer results from the system - * @param $strReference */ public function clear(){ $this->arrTimer = array(); @@ -91,7 +89,6 @@ public function clear(){ /** * Get the full results from any given timer - * @param $strReference * @return mixed */ public function results(){ @@ -100,7 +97,7 @@ public function results(){ /** * Get the timers' current length but do not stop the timer - * @param $strLogTitle + * @param string $strLogTitle * @return int */ public function log($strLogTitle){ diff --git a/dist/twist/Core/Utilities/User.utility.php b/dist/twist/Core/Utilities/User.utility.php index 33e28b7f..3d268f1b 100755 --- a/dist/twist/Core/Utilities/User.utility.php +++ b/dist/twist/Core/Utilities/User.utility.php @@ -337,7 +337,7 @@ public function getLevels(){ } /** - * @param $strVerificationCode + * @param string $strVerificationCode * @return bool */ public function verifyEmail($strVerificationCode){ diff --git a/dist/twist/Core/Utilities/Validate.utility.php b/dist/twist/Core/Utilities/Validate.utility.php index ec564a0b..91d591e1 100755 --- a/dist/twist/Core/Utilities/Validate.utility.php +++ b/dist/twist/Core/Utilities/Validate.utility.php @@ -45,8 +45,8 @@ public function createTest(){ /** * Validate the comparison between two items/strings/integers. * - * @param $mxdValue1 Item one to be compared - * @param $mxdValue2 Item two to be compared + * @param mixed $mxdValue1 Item one to be compared + * @param mixed $mxdValue2 Item two to be compared * @return boolean True returned upon successful comparison of the two items/strings/integers */ public function compare($mxdValue1,$mxdValue2){ @@ -57,7 +57,7 @@ public function compare($mxdValue1,$mxdValue2){ * Validate the format of a Email * * @reference http://php.net/manual/en/filter.constants.php - * @param $strEmailAddress Email Address to be validated + * @param string $strEmailAddress Email Address to be validated * @return mixed */ public function email($strEmailAddress){ @@ -73,7 +73,7 @@ public function email($strEmailAddress){ * - a.b * The first character and last character of any part (split by .) cannot be a - or _ and the last part (.com or .co.uk) can only contain a-z * - * @param $strDomain Domain name excluding the protocol, slashes and spaces + * @param string $strDomain Domain name excluding the protocol, slashes and spaces * @return mixed The returned data will either be the validated domain or false */ public function domain($strDomain){ @@ -84,7 +84,7 @@ public function domain($strDomain){ * Validate the format of a URL * * @reference http://php.net/manual/en/filter.constants.php - * @param $urlFullLink URL to be validated + * @param string $urlFullLink URL to be validated * @return mixed */ public function url($urlFullLink){ @@ -95,8 +95,8 @@ public function url($urlFullLink){ * Validate the format of a IP address, can validate both IPv4 and IPv6 addresses * * @reference http://php.net/manual/en/filter.constants.php - * @param $mxdIPAddress IP address to be validated - * @param $blValidateIPV6 Set to true if and IPv6 address is to be validated + * @param string $mxdIPAddress IP address to be validated + * @param bool $blValidateIPV6 Set to true if and IPv6 address is to be validated * @return mixed */ public function ip($mxdIPAddress,$blValidateIPV6 = false){ @@ -120,7 +120,7 @@ public function datetime($strDatetime) { * Validate a boolean state * * @reference http://php.net/manual/en/filter.constants.php - * @param $blBoolean Boolean to be validated + * @param bool $blBoolean Boolean to be validated * @return mixed */ public function boolean($blBoolean){ @@ -142,9 +142,9 @@ public function float($fltFloat){ * Validate an integer, optionally you can pass in a min and max range for further validation * * @reference http://php.net/manual/en/filter.constants.php - * @param $intInteger Integer to be validated - * @param $intRangeMin Lowest acceptable integer value - * @param $intRangeMax Highest acceptable integer value + * @param integer $intInteger Integer to be validated + * @param integer $intRangeMin Lowest acceptable integer value + * @param integer $intRangeMax Highest acceptable integer value * @return mixed */ public function integer($intInteger,$intRangeMin = null,$intRangeMax = null){ @@ -169,7 +169,7 @@ public function integer($intInteger,$intRangeMin = null,$intRangeMax = null){ /** * Validate a sting, this will ensure the is is not an object, resource or boolean value * - * @param $mxdString String to be validated + * @param string $mxdString String to be validated * @return bool */ public function string($mxdString){ @@ -180,7 +180,7 @@ public function string($mxdString){ * Validate a telephone number, this function if very universal phone number validator also allow for ext|ext.|,|; with upto 4 digit extension. * Optional spacing, brackets and dashes throughout * - * @param $mxdPhoneNumber Phone number to be validated + * @param string $mxdPhoneNumber Phone number to be validated * @return bool|mixed */ public function telephone($mxdPhoneNumber){ @@ -198,7 +198,7 @@ public function telephone($mxdPhoneNumber){ /** * Validate a UK postcode * - * @param $strPostcode Postcode to be validated + * @param string $strPostcode Postcode to be validated * @return bool|mixed|string */ public function postcode($strPostcode){ @@ -262,8 +262,8 @@ public function postcode($strPostcode){ /** * Validate some data using an Regular Expression * - * @param $mxdData Data to be validated - * @param $strRegX Expression used to validate the data + * @param mixed $mxdData Data to be validated + * @param string $strRegX Expression used to validate the data * @return bool */ public function regx($mxdData,$strRegX){ diff --git a/dist/twist/Core/Utilities/View.utility.php b/dist/twist/Core/Utilities/View.utility.php index c62a5360..af22ce2c 100755 --- a/dist/twist/Core/Utilities/View.utility.php +++ b/dist/twist/Core/Utilities/View.utility.php @@ -57,7 +57,7 @@ public function kill(){ /** * Set the View directory to default or provide a new directory - * @param $dirCustomViews Path to a custom View directory + * @param string $dirCustomViews Path to a custom View directory */ public function setDirectory($dirCustomViews = null){ $this->dirViews = (is_null($dirCustomViews)) ? TWIST_APP_VIEWS : $dirCustomViews; @@ -66,7 +66,7 @@ public function setDirectory($dirCustomViews = null){ /** * Get the current View directory/path that is in use by the View utility - * @return directory Returns the current View path + * @return string Returns the current View path */ public function getDirectory(){ return $this->dirViews; @@ -74,7 +74,7 @@ public function getDirectory(){ /** * Function called by readCache, writeCache, removeCache - * @param $strViewPath + * @param string $strViewPath * @return string */ protected function getCacheKey($strViewPath){ @@ -100,7 +100,7 @@ protected function getCacheKey($strViewPath){ /** * Read the view cache file for the relevant cache key - * @param $strViewPath + * @param string $strViewPath * @return null */ protected function readCache($strViewPath){ @@ -118,8 +118,8 @@ protected function readCache($strViewPath){ /** * Write the cache file back for the correct cache key - * @param $strViewPath - * @param $arrData + * @param string $strViewPath + * @param array $arrData */ protected function writeCache($strViewPath,$arrData){ @@ -133,7 +133,7 @@ protected function writeCache($strViewPath,$arrData){ /** * Remove an item from the cache file for the correct cache key - * @param $strViewPath + * @param string $strViewPath */ protected function removeCache($strViewPath){ @@ -150,8 +150,8 @@ protected function removeCache($strViewPath){ /** * Build the View with the array of tags supplied * - * @param $dirView - * @param $arrViewTags + * @param string $dirView + * @param array $arrViewTags * @param bool $blRemoveUnusedTags Remove all un-used tags from the tpl after processing * @param bool $blProcessTags Outputs that raw contents of the TPL file when set to false (dose not work for PHP views) * @return string @@ -222,10 +222,11 @@ public function build($dirView,$arrViewTags = null,$blRemoveUnusedTags = false,$ /** * Replace tags in raw View data with the array of tags supplied * - * @param $strRawViewData - * @param $arrViewTags - * @param $blRemoveUnusedTags + * @param string $strRawViewData + * @param array $arrViewTags + * @param bool $blRemoveUnusedTags * @return string + * @throws \Exception */ public function replace($strRawViewData,$arrViewTags = null,$blRemoveUnusedTags = false) { @@ -283,10 +284,9 @@ protected function getParameters(){ * Additional parameters are exploded of the end of the Element var, these parameters are comma separated. * To retrieve the parameters use $this->getParameters(); in your element. * - * @param $dirElement - * @param $arrData + * @param string $dirView + * @param array $arrData * @return string - * @throws \Exception */ protected function processElement($dirView,$arrData = null){ @@ -303,9 +303,9 @@ protected function processElement($dirView,$arrData = null){ /** * Get all the tags of a given View and return them as an array * - * @param $strView - * @param $blIsFile - * @param $blDiscover + * @param string $mxdView + * @param bool $blIsFile + * @param bool $blDiscover * @return array */ public function getTags($mxdView,$blIsFile = true,$blDiscover = false){ @@ -356,7 +356,7 @@ public function getTags($mxdView,$blIsFile = true,$blDiscover = false){ /** * Removes all tags that remain in the View after use * - * @param $strViewData + * @param string $strViewData * @return string */ public function removeUnusedTags($strViewData){ @@ -432,8 +432,9 @@ protected function parseViewPath($dirView){ /** * Get the raw View data form the View file * - * @param $strViewFullPath + * @param string $strViewFullPath * @return string + * @throws \Exception */ protected function get($strView){ @@ -458,8 +459,8 @@ protected function get($strView){ /** * Locate the line number that a particular tag falls on - * @param $dirViewFile - * @param $strTag + * @param string $dirViewFile + * @param string $strTag * @return int|null|string * @throws \Exception */ @@ -480,35 +481,32 @@ protected function locateTag($dirViewFile,$strTag){ /** * Decide weather the View data tags are valid or not * - * @param $arrViewTags + * @param array $arrViewTags * @return boolean + * @throws \Exception */ protected function validDataTags($arrViewTags){ - $blOut = false; - //Check to see if the tags are set to null if(is_null($arrViewTags)){ - $blOut = true; + return true; }else{ //If the tags contain an array then they can be used if(is_array($arrViewTags)){ - $blOut = true; + return true; }else{ throw new \Exception('View tags are an invalid format, must be and array or null.',11103); } } - - return $blOut; } /** * Process each individual tag from the View one by one * - * @param $strRawView - * @param $strTag - * @param $arrData + * @param string $strRawView + * @param string $strTag + * @param array $arrData * @return mixed */ protected function processTag($strRawView,$strTag,$arrData = array()){ @@ -543,6 +541,8 @@ protected function processTag($strRawView,$strTag,$arrData = array()){ $arrValue1Parts = (strstr($arrConditions[2][$intKey],':')) ? explode(':',$arrConditions[2][$intKey]) : null; $arrValue2Parts = (strstr($arrConditions[4][$intKey],':')) ? explode(':',$arrConditions[4][$intKey]) : null; + $strTempReplace1 = $strTempReplace2 = ''; + //Build the data to correctly decode each tag in condition 1 if(!is_null($arrValue1Parts)){ $strTempTag1 = sprintf('{%s}',$arrConditions[2][$intKey]); @@ -658,7 +658,7 @@ protected function processTag($strRawView,$strTag,$arrData = array()){ /** * Detect and correct the type of the inputs contents * - * @param $mxdValue + * @param mixed $mxdValue * @return bool|int|mixed|null|string */ protected function detectType($mxdValue){ @@ -696,9 +696,9 @@ protected function detectType($mxdValue){ /** * Run the logical comparison between to sets of data * - * @param $mxdValue1 - * @param $strCondition - * @param $mxdValue2 + * @param mixed $mxdValue1 + * @param string $strCondition + * @param mixed $mxdValue2 * @return bool */ protected function condition($mxdValue1,$strCondition,$mxdValue2){ @@ -798,11 +798,12 @@ protected function extractParameters(&$strReference,$arrData = array()){ /** * Run the tag processing on each tag that was found in the View and process them accordingly (Snipit module is required to process multi-dimensional tag arrays) * - * @param $strRawView - * @param $strTag - * @param $strType - * @param $strReference - * @param $arrData + * @param string $strRawView + * @param string $strTag + * @param string $strType + * @param string $strReference + * @param array $arrData + * @param bool $blReturnArray * @return mixed */ public function runTags($strRawView,$strTag,$strType,$strReference,$arrData = array(),$blReturnArray = false){ @@ -936,7 +937,7 @@ public function runTags($strRawView,$strTag,$strType,$strReference,$arrData = ar case'model': - //@todo Currently a little bit hacky but will add support for all models and params shortly + //TODO: Currently a little bit hacky but will add support for all models and params shortly //Currently only supports a model that has been initiated through routes. if(Instance::isObject('twist_route_model')){ $resModel = Instance::retrieveObject('twist_route_model'); @@ -1022,9 +1023,9 @@ public function runTags($strRawView,$strTag,$strType,$strReference,$arrData = ar /** * Find an item within an array of data, return the round status and the return value. * - * @param $strKey Key that can contain / to move though an arrays structure - * @param $arrData Array of data to be searched - * @param $blReturnArray Option to define if an array or string must be retured + * @param string $strKey Key that can contain / to move though an arrays structure + * @param array $arrData Array of data to be searched + * @param bool $blReturnArray Option to define if an array or string must be retured * @return array The results of the search with status */ protected function processArrayItem($strKey,$arrData,$blReturnArray=false){ @@ -1056,11 +1057,12 @@ protected function processArrayItem($strKey,$arrData,$blReturnArray=false){ /** * Replace the tag in the View data with the provided content * - * @param $strRawView - * @param $strTag - * @param $strData - * @param $strFunction - * @param $mxdRawData + * @param string $strRawView + * @param string $strTag + * @param string $strData + * @param string $strFunction + * @param mixed $mxdRawData + * @param array $arrParameters * @return mixed */ protected function replaceTag($strRawView,$strTag,$strData,$strFunction = null,$mxdRawData = array(),$arrParameters = array()){ diff --git a/dist/twist/Core/Utilities/XML.utility.php b/dist/twist/Core/Utilities/XML.utility.php index 74aabb43..fe182719 100755 --- a/dist/twist/Core/Utilities/XML.utility.php +++ b/dist/twist/Core/Utilities/XML.utility.php @@ -39,7 +39,7 @@ public function __construct(){ } /** * Load the raw XML data into the system and expand into an array - * @param $strData + * @param string $strData */ public function loadRawData($strData){ @@ -51,7 +51,7 @@ public function loadRawData($strData){ /** * Load the raw XML from a file or feed and expand into an array - * @param $strLocalFilePath + * @param string $strLocalFilePath */ public function loadFile($strLocalFilePath){ @@ -96,7 +96,7 @@ protected function processXML(){ /** * Expand the linear (raw) array into a usable multi-level array - * @param $intCurrentKey + * @param integer $intCurrentKey * @return array */ protected function expandRawArray($intCurrentKey = -1){ @@ -104,6 +104,7 @@ protected function expandRawArray($intCurrentKey = -1){ $arrXmlData = array(); $intCloseLevel = null; $blEndLoop = false; + $intKey = null; foreach($this->arrRawData as $intKey => $arrEachElement){ @@ -216,8 +217,8 @@ protected function expandRawArray($intCurrentKey = -1){ /** * Turn an array of data into XML - * @param $arrItems - * @param $strTab + * @param array $arrItems + * @param string $strTab * @return string */ public function covertArray($arrItems,$strTab = ""){ @@ -264,9 +265,12 @@ public function covertArray($arrItems,$strTab = ""){ /**** NEW CLASS SETTINGS - In preparation for V2 ****/ + /** + * @param string $strXML + * @return array|bool|mixed + */ public function xmlToArray($strXML){ - $arrOut = array(); libxml_use_internal_errors(true); $strXML = $this->fixUTF8($strXML); @@ -281,14 +285,12 @@ public function xmlToArray($strXML){ echo "\t", $error->message; } - $arrOut = false; + return false; }else{ $strJSON = json_encode($objXML); - $arrOut = json_decode($strJSON, true); + return json_decode($strJSON, true); } - - return $arrOut; } @@ -321,6 +323,8 @@ public function arrayToXML($arrData,$strRootNode = 'node'){ /** * Process the Attributes where they exist + * @param array $arrData + * @return string */ protected function processAttributes(&$arrData){ @@ -338,6 +342,8 @@ protected function processAttributes(&$arrData){ /** * Process the Comment attribute where they exist + * @param array $arrData + * @return string */ protected function processComment(&$arrData){ @@ -354,6 +360,10 @@ protected function processComment(&$arrData){ /** * Recursively go through the array and process each item + * @param array $arrData + * @param string $strTab + * @param string $strPreviousKey + * @return string */ protected function processEachItem($arrData,$strTab="\t",$strPreviousKey=""){ @@ -362,7 +372,7 @@ protected function processEachItem($arrData,$strTab="\t",$strPreviousKey=""){ foreach($arrData as $strKey => $mxdData){ $strParameters = $this->processAttributes($mxdData); - $strComment = $this->processComment($mxdData); + $strComment = $this->processComment($mxdData); //TODO: Remove? //Detect for empty rows if(!is_array($mxdData) && $mxdData == ""){ diff --git a/dist/twist/Twist.php b/dist/twist/Twist.php index 5d8b6275..86dfaefe 100755 --- a/dist/twist/Twist.php +++ b/dist/twist/Twist.php @@ -40,8 +40,8 @@ public function __construct(){ /** * Define PHP Defines but automatically checks to see if has already been defined, if so the new define is ignored but no error is thrown. - * @param $strKey - * @param $mxdValue + * @param string $strKey + * @param mixed $mxdValue */ public static function define($strKey,$mxdValue){ if(!defined($strKey)){ @@ -220,7 +220,7 @@ protected static function errorHandlers(){ /** * Log an error message that can be output using the {messages:} template tag - * @param $strMessage + * @param string $strMessage * @param null $strKey */ public static function errorMessage($strMessage,$strKey = null){ @@ -229,7 +229,7 @@ public static function errorMessage($strMessage,$strKey = null){ /** * Log an warning message that can be output using the {messages:} template tag - * @param $strMessage + * @param string $strMessage * @param null $strKey */ public static function warningMessage($strMessage,$strKey = null){ @@ -238,7 +238,7 @@ public static function warningMessage($strMessage,$strKey = null){ /** * Log an notice message that can be output using the {messages:} template tag - * @param $strMessage + * @param string $strMessage * @param null $strKey */ public static function noticeMessage($strMessage,$strKey = null){ @@ -247,7 +247,7 @@ public static function noticeMessage($strMessage,$strKey = null){ /** * Log an success message that can be output using the {messages:} template tag - * @param $strMessage + * @param string $strMessage * @param null $strKey */ public static function successMessage($strMessage,$strKey = null){ @@ -257,8 +257,8 @@ public static function successMessage($strMessage,$strKey = null){ /** * Redirect the user to a new page or site by URL, optionally you can make the redirect permanent. * URL redirects can be passed in as full path/URL or relative to your current URI. For example you can pass in '../../' or './test' - * @param $urlRedirectURL URL that the user will be redirected too - * @param $blPermanent Set the redirect type to be a Permanent 301 redirect + * @param string $urlRedirect URL that the user will be redirected too + * @param bool $blPermanent Set the redirect type to be a Permanent 301 redirect */ public static function redirect($urlRedirect,$blPermanent = false){ @@ -290,7 +290,7 @@ public static function dump($mxdData = null){ /** * Record events on for the current page load can be logged and a time-line produced, helps with debugging. * The TwistPHP event recorder only records and outputs events if DEVELOPMENT_MODE and DEVELOPMENT_EVENT_RECORDER settings are set to true|1. - * @param $strEventName + * @param string $strEventName */ public static function recordEvent($strEventName){ if(self::$blRecordEvents){ @@ -310,9 +310,9 @@ public static function getEvents($blStopTimer = false){ /** * Process each message as they are added and store them for the current PHP session only - * @param $strMessage - * @param $strKey - * @param $strType + * @param string $strMessage + * @param string $strKey + * @param string $strType */ protected static function messageProcess($strMessage,$strKey,$strType){ @@ -349,7 +349,7 @@ protected static function messageProcess($strMessage,$strKey,$strType){ * Example Tag: * {messages:error,combine=true,key=andi|dan,style=html} * - * @param $strReference + * @param string $strReference * @param array $arrParameters * @return string */ @@ -425,7 +425,7 @@ public static function framework(){ /** * Call 3rd parky packages in the framework located in your packages folder * Alternatively packages can be called '$resMyPackage = new Package\MyPackage();' - * @param $strPackageName + * @param string $strPackageName * @return mixed */ public static function package($strPackageName){