diff --git a/html/typo3conf/ext/ter/class.tx_ter_api.php b/html/typo3conf/ext/ter/class.tx_ter_api.php index 58344f87ef0845aad801f4237cde12e3b3c4f58b..f63973a8cb7d08831efb6ddf3b776d66c880b6af 100755 --- a/html/typo3conf/ext/ter/class.tx_ter_api.php +++ b/html/typo3conf/ext/ter/class.tx_ter_api.php @@ -68,7 +68,7 @@ class tx_ter_api */ public function __construct($parentObj) { - $this->helperObj = new tx_ter_helper ($parentObj); + $this->helperObj = new tx_ter_helper($parentObj); $this->parentObj = $parentObj; $this->cObj = $parentObj->cObj; } @@ -128,15 +128,17 @@ class tx_ter_api // All following code will then fail, because it is tested if it was an array. // To make it work, we wrap the object into an array, so that the following code works as expected if (!empty($extensionInfoData->technicalData->dependencies) && is_object( - $extensionInfoData->technicalData->dependencies - ) + $extensionInfoData->technicalData->dependencies + ) ) { $extensionInfoData->technicalData->dependencies = [$extensionInfoData->technicalData->dependencies]; } $extensionKey = strtolower($extensionInfoData->extensionKey); if (TYPO3_DLOG) { GeneralUtility::devLog( - 'tx_ter_api->uploadExtension()', 'ter', 0, + 'tx_ter_api->uploadExtension()', + 'ter', + 0, 'Upload of extension ' . $extensionKey . ' (' . $extensionInfoData->version . ') by user ' . $accountData->username ); } @@ -147,8 +149,8 @@ class tx_ter_api throw new tx_ter_exception_notFound('Extension "' . $extensionKey . '" does not exist.', TX_TER_ERROR_UPLOADEXTENSION_EXTENSIONDOESNTEXIST); } if (strtolower($extensionKeyRecordArr['ownerusername']) !== strtolower( - $accountData->username - ) && $uploadUserRecordArr['admin'] !== true + $accountData->username + ) && $uploadUserRecordArr['admin'] !== true ) { throw new tx_ter_exception_unauthorized('Access denied.', TX_TER_ERROR_UPLOADEXTENSION_ACCESSDENIED); } @@ -158,7 +160,8 @@ class tx_ter_api throw new tx_ter_exception( 'Your version number "' . htmlspecialchars( $extensionInfoData->version - ) . '" is invalid. Allowed are three numbers with maximum 999, e.g. "7.8.999".', 1429912029 + ) . '" is invalid. Allowed are three numbers with maximum 999, e.g. "7.8.999".', + 1429912029 ); } @@ -245,7 +248,8 @@ class tx_ter_api throw new tx_ter_exception( 'Your version number "' . htmlspecialchars( $extensionInfoData->version - ) . '" is invalid. Allowed are three numbers with maximum 999, e.g. "7.8.999".', 1429912029 + ) . '" is invalid. Allowed are three numbers with maximum 999, e.g. "7.8.999".', + 1429912029 ); } @@ -289,7 +293,9 @@ class tx_ter_api { if (TYPO3_DLOG) { GeneralUtility::devLog( - 'tx_ter_api->deleteExtension()', 'ter', 0, + 'tx_ter_api->deleteExtension()', + 'ter', + 0, 'Deletion of extension ' . $extensionKey . ' (' . $version . ') by user ' . $accountData->username ); } @@ -304,7 +310,8 @@ class tx_ter_api $extensionKeyRecordArr = $this->helperObj->getExtensionKeyRecord($extensionKey); if ($extensionKeyRecordArr == false) { throw new tx_ter_exception_notFound( - 'Extension does not exist.', TX_TER_ERROR_DELETEEXTENSION_EXTENSIONDOESNTEXIST + 'Extension does not exist.', + TX_TER_ERROR_DELETEEXTENSION_EXTENSIONDOESNTEXIST ); } @@ -403,27 +410,33 @@ class tx_ter_api $whereClause = 'pid=' . (int)$this->parentObj->extensionsPID; if (!empty($extensionKeyFilterOptions->username)) { $whereClause .= ' AND ownerusername = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $extensionKeyFilterOptions->username, 'tx_ter_extensionkeys' - ); + $extensionKeyFilterOptions->username, + 'tx_ter_extensionkeys' + ); } if (!empty($extensionKeyFilterOptions->title)) { $whereClause .= ' AND title = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $extensionKeyFilterOptions->title, 'tx_ter_extensionkeys' - ); + $extensionKeyFilterOptions->title, + 'tx_ter_extensionkeys' + ); } if (!empty($extensionKeyFilterOptions->description)) { $whereClause .= ' AND description = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $extensionKeyFilterOptions->description, 'tx_ter_extensionkeys' - ); + $extensionKeyFilterOptions->description, + 'tx_ter_extensionkeys' + ); } if (!empty($extensionKeyFilterOptions->extensionKey)) { $whereClause .= ' AND extensionkey = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $extensionKeyFilterOptions->extensionKey, 'tx_ter_extensionkeys' - ); + $extensionKeyFilterOptions->extensionKey, + 'tx_ter_extensionkeys' + ); } $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( - 'extensionkey,title,description,ownerusername', 'tx_ter_extensionkeys', $whereClause + 'extensionkey,title,description,ownerusername', + 'tx_ter_extensionkeys', + $whereClause ); if ($res) { @@ -433,7 +446,8 @@ class tx_ter_api $resultCode = TX_TER_RESULT_GENERAL_OK; } else { throw new tx_ter_exception_internalServerError( - 'Database error while fetching extension keys.', TX_TER_ERROR_GENERAL_DATABASEERROR + 'Database error while fetching extension keys.', + TX_TER_ERROR_GENERAL_DATABASEERROR ); } @@ -465,15 +479,18 @@ class tx_ter_api if (is_array($extensionKeyRecordArr)) { if (strtolower($extensionKeyRecordArr['ownerusername']) != strtolower( - $accountData->username - ) && $userRecordArr['admin'] !== true + $accountData->username + ) && $userRecordArr['admin'] !== true ) { throw new tx_ter_exception_unauthorized('Access denied.', TX_TER_ERROR_DELETEEXTENSIONKEY_ACCESSDENIED); } $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( - 'extensionkey', 'tx_ter_extensions', 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $extensionKey, 'tx_ter_extensions' + 'extensionkey', + 'tx_ter_extensions', + 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( + $extensionKey, + 'tx_ter_extensions' ) . ' AND pid=' . (int)$this->parentObj->extensionsPID ); @@ -482,13 +499,16 @@ class tx_ter_api $resultCode = TX_TER_ERROR_DELETEEXTENSIONKEY_CANTDELETEBECAUSEVERSIONSEXIST; } else { $res = $GLOBALS['TYPO3_DB']->exec_DELETEquery( - 'tx_ter_extensionkeys', 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $extensionKey, 'tx_ter_extensions' + 'tx_ter_extensionkeys', + 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( + $extensionKey, + 'tx_ter_extensions' ) . ' AND pid=' . (int)$this->parentObj->extensionsPID ); if (!$res) { throw new tx_ter_exception_internalServerError( - 'Database error while deleting extension key.', TX_TER_ERROR_GENERAL_DATABASEERROR + 'Database error while deleting extension key.', + TX_TER_ERROR_GENERAL_DATABASEERROR ); } @@ -497,7 +517,8 @@ class tx_ter_api } } else { throw new tx_ter_exception_internalServerError( - 'Database error while fetching versions.', TX_TER_ERROR_GENERAL_DATABASEERROR + 'Database error while fetching versions.', + TX_TER_ERROR_GENERAL_DATABASEERROR ); } } else { @@ -539,8 +560,8 @@ class tx_ter_api if (is_array($extensionKeyRecordArr)) { if (strtolower($extensionKeyRecordArr['ownerusername']) != strtolower( - $accountData->username - ) && $userRecordArr['admin'] !== true + $accountData->username + ) && $userRecordArr['admin'] !== true ) { throw new tx_ter_exception_unauthorized('Access denied.', TX_TER_ERROR_MODIFYEXTENSIONKEY_ACCESSDENIED); } @@ -614,7 +635,8 @@ class tx_ter_api 'DownloadCounter: Trying to increase extension download counters - user "' . $accountData->username . '" connected from IP "' . GeneralUtility::getIndpEnv( 'REMOTE_ADDR' ) . '" - number of results: ' . count($extensionVersionsAndIncrementors->extensionVersionAndIncrementor), - 'tx_ter_api', 0 + 'tx_ter_api', + 0 ); $userRecordArr = $this->helperObj->getValidUser($accountData); @@ -622,7 +644,9 @@ class tx_ter_api if ($mirrorsFrontendUsergroupUid == 0) { GeneralUtility::devLog( - 'DownloadCounter: No usergroup for mirrors has been defined on the server side. Aborting ...', 'tx_ter_api', 3 + 'DownloadCounter: No usergroup for mirrors has been defined on the server side. Aborting ...', + 'tx_ter_api', + 3 ); throw new tx_ter_exception_internalServerError( 'Warning: No usergroup for mirrors has been defined on the server side. Aborting ...', @@ -631,7 +655,10 @@ class tx_ter_api } if (!GeneralUtility::inList($userRecordArr['usergroup'], $mirrorsFrontendUsergroupUid)) { GeneralUtility::devLog( - 'DownloadCounter: Access denied for user ' . $accountData->username, 'tx_ter_api', 3, $userRecordArr + 'DownloadCounter: Access denied for user ' . $accountData->username, + 'tx_ter_api', + 3, + $userRecordArr ); throw new tx_ter_exception_unauthorized('Access denied.', TX_TER_ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_ACCESSDENIED); } @@ -658,7 +685,8 @@ class tx_ter_api GeneralUtility::devLog( 'DownloadCounter: Increased download counter for ' . $counter . ' extensions. User "' . $accountData->username . '".', - 'tx_ter_api', 0 + 'tx_ter_api', + 0 ); // Update extension index file $this->helperObj->requestUpdateOfExtensionIndexFile(); @@ -666,7 +694,10 @@ class tx_ter_api // Return results including list of error messages if any if (!empty($errorMessages)) { GeneralUtility::devLog( - 'DownloadCounter: Errors occured for user "' . $accountData->username . '".', 'tx_ter_api', 2, $errorMessages + 'DownloadCounter: Errors occured for user "' . $accountData->username . '".', + 'tx_ter_api', + 2, + $errorMessages ); $result = [ 'resultCode' => TX_TER_RESULT_ERRORS_OCCURRED, @@ -718,7 +749,8 @@ class tx_ter_api { if (!@is_dir($this->parentObj->repositoryDir)) { throw new tx_ter_exception_internalServerError( - 'Extension repository directory does not exist.', TX_TER_ERROR_GENERAL_EXTREPDIRDOESNTEXIST + 'Extension repository directory does not exist.', + TX_TER_ERROR_GENERAL_EXTREPDIRDOESNTEXIST ); } if (!is_array($filesData->fileData)) { @@ -728,11 +760,11 @@ class tx_ter_api // Prepare Files Data Array: $preparedFilesDataArr = []; foreach ($filesData->fileData as $fileData) { - $decodedContent = base64_decode($fileData->content); if ($fileData->contentMD5 != md5($decodedContent)) { throw new tx_ter_exception_notFound( - 'MD5 does not match for file ' . (string)$fileData->name, TX_TER_ERROR_UPLOADEXTENSION_FILEMD5DOESNOTMATCH + 'MD5 does not match for file ' . (string)$fileData->name, + TX_TER_ERROR_UPLOADEXTENSION_FILEMD5DOESNOTMATCH ); } @@ -753,8 +785,10 @@ class tx_ter_api foreach ($extensionInfoData->technicalData->dependencies as $dependency) { $dependency = json_decode(json_encode($dependency), true); if (!empty($dependency['kind']) && !empty($dependency['extensionKey']) && in_array( - $dependency['kind'], ['depends', 'conflicts', 'suggests'], true - ) + $dependency['kind'], + ['depends', 'conflicts', 'suggests'], + true + ) ) { $constraints[$dependency['kind']][$dependency['extensionKey']] = (string)$dependency['versionRange']; } @@ -776,7 +810,9 @@ class tx_ter_api 'createDirs' => $extensionInfoData->technicalData->createDirs, 'modify_tables' => $extensionInfoData->technicalData->modifyTables, 'clearcacheonload' => in_array( - strtolower((string)$extensionInfoData->technicalData->clearCacheOnLoad), ['1', 'false'], true + strtolower((string)$extensionInfoData->technicalData->clearCacheOnLoad), + ['1', 'false'], + true ), 'lockType' => $extensionInfoData->technicalData->lockType, 'author' => $extensionInfoData->metaData->authorName, @@ -820,7 +856,8 @@ class tx_ter_api } list($majorVersion, $minorVersion, $devVersion) = GeneralUtility::intExplode( - '.', $extensionInfoData->version + '.', + $extensionInfoData->version ); $t3xFileName = $extensionKey . '_' . $majorVersion . '.' . $minorVersion . '.' . $devVersion . '.t3x'; @@ -1021,15 +1058,20 @@ class tx_ter_api { if (!@is_dir($this->parentObj->repositoryDir)) { throw new tx_ter_exception_internalServerError( - 'Extension repository directory does not exist.', TX_TER_ERROR_GENERAL_EXTREPDIRDOESNTEXIST + 'Extension repository directory does not exist.', + TX_TER_ERROR_GENERAL_EXTREPDIRDOESNTEXIST ); } $result = $GLOBALS['TYPO3_DB']->exec_SELECTquery( - 'uid', 'tx_ter_extensions', 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $extensionKey, 'tx_ter_extensions' + 'uid', + 'tx_ter_extensions', + 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( + $extensionKey, + 'tx_ter_extensions' ) . ' AND version=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $version, 'tx_ter_extensions' + $version, + 'tx_ter_extensions' ) . ' AND pid=' . (int)$this->parentObj->extensionsPID ); if (!$result) { @@ -1047,7 +1089,8 @@ class tx_ter_api } $result = $GLOBALS['TYPO3_DB']->exec_DELETEquery( - 'tx_ter_extensiondetails', 'extensionuid = ' . (int)$extensionRow['uid'] + 'tx_ter_extensiondetails', + 'extensionuid = ' . (int)$extensionRow['uid'] ); if (!$result) { throw new tx_ter_exception_internalServerError( @@ -1056,8 +1099,10 @@ class tx_ter_api ); } $result = $GLOBALS['TYPO3_DB']->exec_DELETEquery( - 'tx_ter_extensions', 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $extensionKey, 'tx_ter_extensions' + 'tx_ter_extensions', + 'extensionkey=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( + $extensionKey, + 'tx_ter_extensions' ) . ' AND version=' . $GLOBALS['TYPO3_DB']->fullquoteStr($version, 'tx_ter_extensions') ); if (!$result) { @@ -1100,8 +1145,11 @@ class tx_ter_api { return $GLOBALS['TYPO3_DB']->sql_num_rows( $GLOBALS['TYPO3_DB']->exec_SELECTquery( - 'uid', 'tx_ter_extensions', 'extensionkey = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - strtolower($extensionInfoData->extensionKey), 'tx_ter_extensions' + 'uid', + 'tx_ter_extensions', + 'extensionkey = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr( + strtolower($extensionInfoData->extensionKey), + 'tx_ter_extensions' ) . ' AND version = ' . $GLOBALS['TYPO3_DB']->fullQuoteStr($extensionInfoData->version, 'tx_ter_extensions') ) ); @@ -1303,7 +1351,8 @@ class tx_ter_api $result = $GLOBALS['TYPO3_DB']->exec_INSERTquery('tx_ter_extensionkeys', $extensionKeysRow); if (!$result) { throw new tx_ter_exception_internalServerError( - 'Database error while inserting extension key.', TX_TER_ERROR_REGISTEREXTENSIONKEY_DBERRORWHILEINSERTINGKEY + 'Database error while inserting extension key.', + TX_TER_ERROR_REGISTEREXTENSIONKEY_DBERRORWHILEINSERTINGKEY ); } } @@ -1332,11 +1381,14 @@ class tx_ter_api { $updateValues = []; - if (isset ($modifyExtensionKeyData->ownerUsername)) { + if (isset($modifyExtensionKeyData->ownerUsername)) { $modifyExtensionKeyData->ownerUsername; $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( - '*', 'fe_users', 'username=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $modifyExtensionKeyData->ownerUsername, 'fe_users' + '*', + 'fe_users', + 'username=' . $GLOBALS['TYPO3_DB']->fullQuoteStr( + $modifyExtensionKeyData->ownerUsername, + 'fe_users' ) . $GLOBALS['TSFE']->sys_page->enableFields('fe_users') ); if ($newOwnerUserRecordArr = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { @@ -1353,7 +1405,8 @@ class tx_ter_api ); if (!$res) { throw new tx_ter_exception_internalServerError( - 'Database error while updating extension key.', TX_TER_ERROR_GENERAL_DATABASEERROR + 'Database error while updating extension key.', + TX_TER_ERROR_GENERAL_DATABASEERROR ); } @@ -1383,30 +1436,38 @@ class tx_ter_api protected function setReviewState_writeNewStateIntoDB($setReviewStateData) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( - 'uid', 'tx_ter_extensions', 'extensionkey =' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $setReviewStateData->extensionKey, 'tx_ter_extensions' + 'uid', + 'tx_ter_extensions', + 'extensionkey =' . $GLOBALS['TYPO3_DB']->fullQuoteStr( + $setReviewStateData->extensionKey, + 'tx_ter_extensions' ) . ' AND ' . 'version =' . $GLOBALS['TYPO3_DB']->fullQuoteStr($setReviewStateData->version, 'tx_ter_extensions') ); if (!$res) { throw new tx_ter_exception_internalServerError( - 'Database error while searching for extension record.', TX_TER_ERROR_GENERAL_DATABASEERROR + 'Database error while searching for extension record.', + TX_TER_ERROR_GENERAL_DATABASEERROR ); } if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) != 1) { throw new tx_ter_exception_notFound( - 'Extension version does not exist.', TX_TER_ERROR_SETREVIEWSTATE_EXTENSIONVERSIONDOESNOTEXIST + 'Extension version does not exist.', + TX_TER_ERROR_SETREVIEWSTATE_EXTENSIONVERSIONDOESNOTEXIST ); } $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery( - 'tx_ter_extensions', 'extensionkey =' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $setReviewStateData->extensionKey, 'tx_ter_extensions' + 'tx_ter_extensions', + 'extensionkey =' . $GLOBALS['TYPO3_DB']->fullQuoteStr( + $setReviewStateData->extensionKey, + 'tx_ter_extensions' ) . ' AND ' . 'version =' . $GLOBALS['TYPO3_DB']->fullQuoteStr($setReviewStateData->version, 'tx_ter_extensions'), ['reviewstate' => (int)$setReviewStateData->reviewState] ); if (!$res) { throw new tx_ter_exception_internalServerError( - 'Database error while updating extension review state.', TX_TER_ERROR_GENERAL_DATABASEERROR + 'Database error while updating extension review state.', + TX_TER_ERROR_GENERAL_DATABASEERROR ); } } @@ -1435,20 +1496,26 @@ class tx_ter_api protected function increaseExtensionDownloadCounter_increaseCounterInDB($extensionVersionDataAndIncrementor) { $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( - 'uid, downloadcounter', 'tx_ter_extensions', 'extensionkey =' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $extensionVersionDataAndIncrementor->extensionKey, 'tx_ter_extensions' + 'uid, downloadcounter', + 'tx_ter_extensions', + 'extensionkey =' . $GLOBALS['TYPO3_DB']->fullQuoteStr( + $extensionVersionDataAndIncrementor->extensionKey, + 'tx_ter_extensions' ) . ' AND ' . 'version =' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $extensionVersionDataAndIncrementor->version, 'tx_ter_extensions' + $extensionVersionDataAndIncrementor->version, + 'tx_ter_extensions' ) ); if (!$res) { throw new tx_ter_exception_internalServerError( - 'Database error while searching for extension record.', TX_TER_ERROR_GENERAL_DATABASEERROR + 'Database error while searching for extension record.', + TX_TER_ERROR_GENERAL_DATABASEERROR ); } if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) != 1) { throw new tx_ter_exception_notFound( - 'Extension version does not exist.', TX_TER_ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_EXTENSIONVERSIONDOESNOTEXIST + 'Extension version does not exist.', + TX_TER_ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_EXTENSIONVERSIONDOESNOTEXIST ); } @@ -1463,27 +1530,35 @@ class tx_ter_api $newCounter = $currentRow['downloadcounter'] + $incrementor; $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery( - 'tx_ter_extensions', 'uid=' . (int)$currentRow['uid'], ['downloadcounter' => $newCounter] + 'tx_ter_extensions', + 'uid=' . (int)$currentRow['uid'], + ['downloadcounter' => $newCounter] ); if (!$res) { throw new tx_ter_exception_internalServerError( - 'Database error while updating extension download counter.', TX_TER_ERROR_GENERAL_DATABASEERROR + 'Database error while updating extension download counter.', + TX_TER_ERROR_GENERAL_DATABASEERROR ); } $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( - 'uid, downloadcounter', 'tx_ter_extensionkeys', 'extensionkey =' . $GLOBALS['TYPO3_DB']->fullQuoteStr( - $extensionVersionDataAndIncrementor->extensionKey, 'tx_ter_extensions' + 'uid, downloadcounter', + 'tx_ter_extensionkeys', + 'extensionkey =' . $GLOBALS['TYPO3_DB']->fullQuoteStr( + $extensionVersionDataAndIncrementor->extensionKey, + 'tx_ter_extensions' ) ); if (!$res) { throw new tx_ter_exception_internalServerError( - 'Database error while searching for extension key record.', TX_TER_ERROR_GENERAL_DATABASEERROR + 'Database error while searching for extension key record.', + TX_TER_ERROR_GENERAL_DATABASEERROR ); } if ($GLOBALS['TYPO3_DB']->sql_num_rows($res) != 1) { throw new tx_ter_exception_notFound( - 'Extension key does not exist.', TX_TER_ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_EXTENSIONKEYDOESNOTEXIST + 'Extension key does not exist.', + TX_TER_ERROR_INCREASEEXTENSIONDOWNLOADCOUNTER_EXTENSIONKEYDOESNOTEXIST ); } @@ -1491,11 +1566,14 @@ class tx_ter_api $newCounter = $currentRow['downloadcounter'] + $incrementor; $res = $GLOBALS['TYPO3_DB']->exec_UPDATEquery( - 'tx_ter_extensionkeys', 'uid=' . (int)$currentRow['uid'], ['downloadcounter' => $newCounter] + 'tx_ter_extensionkeys', + 'uid=' . (int)$currentRow['uid'], + ['downloadcounter' => $newCounter] ); if (!$res) { throw new tx_ter_exception_internalServerError( - 'Database error while updating extension total download counter.', TX_TER_ERROR_GENERAL_DATABASEERROR + 'Database error while updating extension total download counter.', + TX_TER_ERROR_GENERAL_DATABASEERROR ); } } diff --git a/html/typo3conf/ext/ter/class.tx_ter_exception.php b/html/typo3conf/ext/ter/class.tx_ter_exception.php index 992f9df906e59601059db55dbbc9687c33c03d3b..c2b52c03ebd4cc2cbe1bdea55ecc91816dc3de43 100644 --- a/html/typo3conf/ext/ter/class.tx_ter_exception.php +++ b/html/typo3conf/ext/ter/class.tx_ter_exception.php @@ -14,4 +14,4 @@ */ class tx_ter_exception extends Exception { -} \ No newline at end of file +} diff --git a/html/typo3conf/ext/ter/class.tx_ter_helper.php b/html/typo3conf/ext/ter/class.tx_ter_helper.php index 9328997374bddc381632f0b5c04ae9df829b26d8..2d19a8a9a310266a18175fcc2c042768d2f3f06c 100755 --- a/html/typo3conf/ext/ter/class.tx_ter_helper.php +++ b/html/typo3conf/ext/ter/class.tx_ter_helper.php @@ -42,7 +42,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; // Make sure that we are executed only in TYPO3 context if (!defined('TYPO3_MODE')) { - die ('Access denied.'); + die('Access denied.'); } // Error codes: @@ -135,25 +135,30 @@ class tx_ter_helper public function getValidUser($accountData) { if (!strlen($accountData->username) || (!strlen($accountData->password))) { - throw new tx_ter_exception_unauthorized ('No user or no password submitted.', TX_TER_ERROR_GENERAL_NOUSERORPASSWORD); + throw new tx_ter_exception_unauthorized('No user or no password submitted.', TX_TER_ERROR_GENERAL_NOUSERORPASSWORD); } $res = $this->getDatabaseConnection()->exec_SELECTquery( - '*', 'fe_users', + '*', + 'fe_users', 'username=' . $this->getDatabaseConnection()->fullQuoteStr($accountData->username, 'fe_users') . $this->getTyposcriptFrontendObject()->sys_page->enableFields('fe_users') ); if ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) { - if (!$this->userIsAlreadyLoggedIn($accountData) && !$this->ldapValidationSucceeded($accountData)) { + + if (!$this->userIsAlreadyLoggedIn( $accountData + ) && !$this->ldapValidationSucceeded($accountData) + ) { throw new tx_ter_exception_unauthorized ('Wrong password.', TX_TER_ERROR_GENERAL_WRONGPASSWORD); } } else { - throw new tx_ter_exception_unauthorized ('The specified user does not exist. You need to login first on extensions.typo3.org.', TX_TER_ERROR_GENERAL_USERNOTFOUND); + throw new tx_ter_exception_unauthorized('The specified user does not exist. You need to login first on extensions.typo3.org.', TX_TER_ERROR_GENERAL_USERNOTFOUND); } $row['admin'] = (intval($this->pluginObj->conf['adminFrontendUsergroupUid']) && GeneralUtility::inList( - $row['usergroup'], $this->pluginObj->conf['adminFrontendUsergroupUid'] - )); + $row['usergroup'], + $this->pluginObj->conf['adminFrontendUsergroupUid'] + )); return $row; } @@ -211,13 +216,18 @@ class tx_ter_helper } else { $success = false; $res = $this->getDatabaseConnection()->exec_SELECTquery( - '*', 'fe_users', 'username=' . $this->getDatabaseConnection()->fullQuoteStr( - $accountData->username, 'fe_users' + '*', + 'fe_users', + 'username=' . $this->getDatabaseConnection()->fullQuoteStr( + $accountData->username, + 'fe_users' ) . $GLOBALS['TSFE']->sys_page->enableFields('fe_users') ); if ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) { - if ($this->ldapValidationSucceeded($accountData)) { + + if ($this->ldapValidationSucceeded( $accountData) + ) { $success = true; } } @@ -243,7 +253,9 @@ class tx_ter_helper $isAvailable = true; $res = $this->getDatabaseConnection()->exec_SELECTquery( - 'extensionkey', 'tx_ter_extensionkeys', 'pid=' . intval($this->pluginObj->extensionsPID) + 'extensionkey', + 'tx_ter_extensionkeys', + 'pid=' . intval($this->pluginObj->extensionsPID) ); while ($row = $this->getDatabaseConnection()->sql_fetch_row($res)) { if ($cleanedExtensionKey === str_replace('_', '', $row[0])) { @@ -287,7 +299,9 @@ class tx_ter_helper public function getLatestVersionNumberOfExtension($extensionKey) { $res = $this->getDatabaseConnection()->exec_SELECTquery( - 'version', 'tx_ter_extensions', 'extensionkey=' . $this->getDatabaseConnection()->fullQuoteStr($extensionKey, 'tx_ter_extensions') . ' + 'version', + 'tx_ter_extensions', + 'extensionkey=' . $this->getDatabaseConnection()->fullQuoteStr($extensionKey, 'tx_ter_extensions') . ' AND pid=' . intval($this->pluginObj->extensionsPID) ); $latestVersion = false; @@ -333,7 +347,8 @@ class tx_ter_helper GeneralUtility::devLog('writing extension index!', 'tx_ter_helper', 0); if (!@is_dir($this->pluginObj->repositoryDir)) { throw new tx_ter_exception_internalServerError( - 'Extension repository directory does not exist.', TX_TER_ERROR_GENERAL_EXTREPDIRDOESNTEXIST + 'Extension repository directory does not exist.', + TX_TER_ERROR_GENERAL_EXTREPDIRDOESNTEXIST ); } @@ -341,14 +356,16 @@ class tx_ter_helper $res = $this->getDatabaseConnection()->exec_SELECTquery( 'uid,tstamp,extensionkey,version,title,description,state,reviewstate,category,downloadcounter,t3xfilemd5', - 'tx_ter_extensions', '1' + 'tx_ter_extensions', + '1' ); // Read the extension records from the DB: $extensionsAndVersionsArr = []; $extensionsTotalDownloadsArr = []; while ($row = $this->getDatabaseConnection()->sql_fetch_assoc($res)) { $res2 = $this->getDatabaseConnection()->exec_SELECTquery( - 'ownerusername,downloadcounter', 'tx_ter_extensionkeys', + 'ownerusername,downloadcounter', + 'tx_ter_extensionkeys', 'extensionkey=' . $this->getDatabaseConnection()->fullQuoteStr($row['extensionkey'], 'tx_ter_extensionkeys') ); $extensionKeyRow = $this->getDatabaseConnection()->sql_fetch_assoc($res2); @@ -357,7 +374,8 @@ class tx_ter_helper $res2 = $this->getDatabaseConnection()->exec_SELECTquery( 'lastuploaddate,uploadcomment,dependencies,composerinfo,authorname,authoremail,authorcompany', - 'tx_ter_extensiondetails', 'extensionuid=' . (int)$row['uid'] + 'tx_ter_extensiondetails', + 'extensionuid=' . (int)$row['uid'] ); $detailsRow = $this->getDatabaseConnection()->sql_fetch_assoc($res2); if (is_array($detailsRow)) { @@ -366,23 +384,24 @@ class tx_ter_helper $extensionsAndVersionsArr [$row['extensionkey']]['versions'][$row['version']] = $row; } // Prepare the DOM object: - $dom = new DOMDocument ('1.0', 'utf-8'); + $dom = new DOMDocument('1.0', 'utf-8'); $dom->formatOutput = true; $extensionsObj = $dom->appendChild(new DOMElement('extensions')); // Create the nested XML structure: foreach ($extensionsAndVersionsArr as $extensionKey => $extensionVersionsArr) { $extensionObj = $extensionsObj->appendChild(new DOMElement('extension')); - $extensionObj->appendChild(new DOMAttr ('extensionkey', $extensionKey)); + $extensionObj->appendChild(new DOMAttr('extensionkey', $extensionKey)); $extensionObj->appendChild( - new DOMElement ( - 'downloadcounter', $this->xmlentities($extensionsTotalDownloadsArr[$extensionKey]) + new DOMElement( + 'downloadcounter', + $this->xmlentities($extensionsTotalDownloadsArr[$extensionKey]) ) ); foreach ($extensionVersionsArr['versions'] as $versionNumber => $extensionVersionArr) { $versionObj = $extensionObj->appendChild(new DOMElement('version')); - $versionObj->appendChild(new DOMAttr ('version', $versionNumber)); + $versionObj->appendChild(new DOMAttr('version', $versionNumber)); $versionObj->appendChild(new DOMElement('title', $this->xmlentities($extensionVersionArr['title']))); $versionObj->appendChild(new DOMElement('description', $this->xmlentities($extensionVersionArr['description']))); $versionObj->appendChild(new DOMElement('state', $this->xmlentities($extensionVersionArr['state']))); @@ -390,13 +409,15 @@ class tx_ter_helper $versionObj->appendChild(new DOMElement('category', $this->xmlentities($extensionVersionArr['category']))); $versionObj->appendChild( new DOMElement( - 'downloadcounter', $this->xmlentities($extensionVersionArr['downloadcounter']) + 'downloadcounter', + $this->xmlentities($extensionVersionArr['downloadcounter']) ) ); $versionObj->appendChild(new DOMElement('lastuploaddate', $extensionVersionArr['lastuploaddate'])); $versionObj->appendChild( new DOMElement( - 'uploadcomment', $this->xmlentities($extensionVersionArr['uploadcomment']) + 'uploadcomment', + $this->xmlentities($extensionVersionArr['uploadcomment']) ) ); $versionObj->appendChild(new DOMElement('dependencies', $extensionVersionArr['dependencies'])); @@ -405,12 +426,14 @@ class tx_ter_helper $versionObj->appendChild(new DOMElement('authoremail', $this->xmlentities($extensionVersionArr['authoremail']))); $versionObj->appendChild( new DOMElement( - 'authorcompany', $this->xmlentities($extensionVersionArr['authorcompany']) + 'authorcompany', + $this->xmlentities($extensionVersionArr['authorcompany']) ) ); $versionObj->appendChild( new DOMElement( - 'ownerusername', $this->xmlentities($extensionVersionArr['ownerusername']) + 'ownerusername', + $this->xmlentities($extensionVersionArr['ownerusername']) ) ); $versionObj->appendChild(new DOMElement('t3xfilemd5', $extensionVersionArr['t3xfilemd5'])); @@ -423,7 +446,7 @@ class tx_ter_helper // Write XML data to disk: $fh = fopen($this->pluginObj->repositoryDir . 'new-extensions.xml.gz', 'wb'); if (!$fh) { - throw new tx_ter_exception_internalServerError ( + throw new tx_ter_exception_internalServerError( 'Write error while writing extensions index file: ' . $this->pluginObj->repositoryDir . 'extensions.xml', TX_TER_ERROR_UPLOADEXTENSION_WRITEERRORWHILEWRITINGEXTENSIONSINDEX ); @@ -442,14 +465,15 @@ class tx_ter_helper @unlink($this->pluginObj->repositoryDir . 'extensions.xml.gz'); rename($this->pluginObj->repositoryDir . 'new-extensions.xml.gz', $this->pluginObj->repositoryDir . 'extensions.xml.gz'); GeneralUtility::writeFile( - $this->pluginObj->repositoryDir . 'extensions.md5', md5_file($this->pluginObj->repositoryDir . 'extensions.xml.gz') + $this->pluginObj->repositoryDir . 'extensions.md5', + md5_file($this->pluginObj->repositoryDir . 'extensions.xml.gz') ); // Write serialized array file to disk: $fh = fopen($this->pluginObj->repositoryDir . 'new-extensions.bin', 'wb'); if (!$fh) { - throw new tx_ter_exception_internalServerError ( + throw new tx_ter_exception_internalServerError( 'Write error while writing extensions index file: ' . $this->pluginObj->repositoryDir . 'extensions.bin', TX_TER_ERROR_UPLOADEXTENSION_WRITEERRORWHILEWRITINGEXTENSIONSINDEX ); @@ -459,7 +483,7 @@ class tx_ter_helper if (!@filesize($this->pluginObj->repositoryDir . 'new-extensions.bin') > 0) { GeneralUtility::devLog('Newly created extension index is zero bytes!', 'tx_ter_helper', 0); - throw new tx_ter_exception_internalServerError ( + throw new tx_ter_exception_internalServerError( 'Write error while writing extensions index file (zero bytes): ' . $this->pluginObj->repositoryDir . 'extensions.bin', TX_TER_ERROR_UPLOADEXTENSION_WRITEERRORWHILEWRITINGEXTENSIONSINDEX ); @@ -467,7 +491,6 @@ class tx_ter_helper @unlink($this->pluginObj->repositoryDir . 'extensions.bin'); rename($this->pluginObj->repositoryDir . 'new-extensions.bin', $this->pluginObj->repositoryDir . 'extensions.bin'); - } /** diff --git a/html/typo3conf/ext/ter/class.tx_ter_tcaLabel.php b/html/typo3conf/ext/ter/class.tx_ter_tcaLabel.php index 6b61173697319ac31f8dafc183192123ed4d5465..741f5966035c2774659b8bf26ce6bea1cb5a78cb 100755 --- a/html/typo3conf/ext/ter/class.tx_ter_tcaLabel.php +++ b/html/typo3conf/ext/ter/class.tx_ter_tcaLabel.php @@ -36,7 +36,9 @@ class tx_ter_tcaLabel } $result = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow( - 'extensionkey', 'tx_ter_extensions', 'uid=' . (int)$params['row']['uid'] + 'extensionkey', + 'tx_ter_extensions', + 'uid=' . (int)$params['row']['uid'] ); if (!empty($result['extensionkey'])) { @@ -45,5 +47,4 @@ class tx_ter_tcaLabel $params['title'] = (int)$params['row']['uid']; } } - -} \ No newline at end of file +} diff --git a/html/typo3conf/ext/ter/cli/build-extension-index.php b/html/typo3conf/ext/ter/cli/build-extension-index.php index 4055f9bd109a03305d5c6e2f61c805cf625cd512..fa3763b13ed291f3cd32ea6f54aff8e3e0572f92 100755 --- a/html/typo3conf/ext/ter/cli/build-extension-index.php +++ b/html/typo3conf/ext/ter/cli/build-extension-index.php @@ -73,7 +73,6 @@ class tx_ter_buildextensionindex } } } - } $pluginObj = new tx_ter_buildextensionindex(); diff --git a/html/typo3conf/ext/ter/cli/conf.php b/html/typo3conf/ext/ter/cli/conf.php index 63e6b62ee05ce26ef7df6a7f979f442a51636ae3..c1727fd41c6dc5005e4ebc5dfa3dbf40f950bf92 100755 --- a/html/typo3conf/ext/ter/cli/conf.php +++ b/html/typo3conf/ext/ter/cli/conf.php @@ -4,5 +4,3 @@ define('TYPO3_MOD_PATH', '../typo3conf/ext/ter/cli/'); $BACK_PATH = '../../../../typo3/'; $MCONF['name'] = '_CLI_ter'; - -?> diff --git a/html/typo3conf/ext/ter/cli/fix-uploadcomments.php b/html/typo3conf/ext/ter/cli/fix-uploadcomments.php index 6d84c495bdab229fd5fb2b4eaca478e7555abfb2..e6ce82191e54ff77743c97f886e07728df1ba6e8 100755 --- a/html/typo3conf/ext/ter/cli/fix-uploadcomments.php +++ b/html/typo3conf/ext/ter/cli/fix-uploadcomments.php @@ -1,7 +1,7 @@ #! /usr/bin/php -q exec_SELECTquery( - 'uid, uploadcomment', 'tx_ter_extensiondetails', '1' + 'uid, uploadcomment', + 'tx_ter_extensiondetails', + '1' ); $counter = 0; @@ -24,4 +26,4 @@ while ($row = $TYPO3_DB->sql_fetch_assoc($res)) { } } -?> \ No newline at end of file +?> diff --git a/html/typo3conf/ext/ter/cli/import-from-ter1_cli.php b/html/typo3conf/ext/ter/cli/import-from-ter1_cli.php index 746180f1653da84fb8f8a36b3e5f8a8970589b5f..a8d49e4ba875fd8c4ddee2766d1b0750b7050a9e 100755 --- a/html/typo3conf/ext/ter/cli/import-from-ter1_cli.php +++ b/html/typo3conf/ext/ter/cli/import-from-ter1_cli.php @@ -10,7 +10,7 @@ * Keep off - never ever use this at TYPO3.org again ... */ -die ('Better not ...'); +die('Better not ...'); // Defining circumstances for CLI mode: define('TYPO3_cliMode', true); @@ -35,7 +35,11 @@ $extensionsPID = 1320; writeExtensionIndexfile(); $res = $TYPO3_DB->exec_SELECTquery( - '*', 'tx_extrep_keytable', 'hidden=0 AND deleted=0', '', 'extension_key ASC' + '*', + 'tx_extrep_keytable', + 'hidden=0 AND deleted=0', + '', + 'extension_key ASC' ); $startTime = time(); @@ -45,7 +49,9 @@ while ($extensionKeyRow = $TYPO3_DB->sql_fetch_assoc($res)) { $extensionKeyCounter++; $res2 = $TYPO3_DB->exec_SELECTquery( - 'username', 'fe_users', 'uid = ' . $extensionKeyRow['owner_fe_user'] + 'username', + 'fe_users', + 'uid = ' . $extensionKeyRow['owner_fe_user'] ); $feUsersRow = $TYPO3_DB->sql_fetch_assoc($res2); $accountData['username'] = $feUsersRow['username']; @@ -53,7 +59,6 @@ while ($extensionKeyRow = $TYPO3_DB->sql_fetch_assoc($res)) { echo('importing ' . str_pad($extensionKeyRow['extension_key'] . ' (' . $feUsersRow['username'] . ')', 40, ' ')); if (intval($extensionKeyRow['members_only'])) { - $newExtensionKeyRow = [ 'tstamp' => $extensionKeyRow['tstamp'], 'crdate' => $extensionKeyRow['crdate'], @@ -67,12 +72,14 @@ while ($extensionKeyRow = $TYPO3_DB->sql_fetch_assoc($res)) { ]; $TYPO3_DB->exec_INSERTquery( - 'tx_ter_extensionkeys', $newExtensionKeyRow + 'tx_ter_extensionkeys', + $newExtensionKeyRow ); - } else { $res2 = $TYPO3_DB->exec_SELECTquery( - '*', 'tx_extrep_repository', 'extension_uid = ' . $extensionKeyRow['uid'] + '*', + 'tx_extrep_repository', + 'extension_uid = ' . $extensionKeyRow['uid'] ); $versionOfExtension = 1; @@ -118,17 +125,21 @@ function getExtensionDataFromRepositoryRow($extensionKeyRow, $extensionVersionRo // *** DEPENDENCIES $typo3VersionMax = $extensionVersionRow['emconf_TYPO3_version_max'] > 0 ? versionConv( - $extensionVersionRow['emconf_TYPO3_version_max'], 1 + $extensionVersionRow['emconf_TYPO3_version_max'], + 1 ) : ''; $typo3VersionMin = $extensionVersionRow['emconf_TYPO3_version_min'] > 0 ? versionConv( - $extensionVersionRow['emconf_TYPO3_version_min'], 1 + $extensionVersionRow['emconf_TYPO3_version_min'], + 1 ) : ''; $phpVersionMax = $extensionVersionRow['emconf_PHP_version_max'] > 0 ? versionConv( - $extensionVersionRow['emconf_PHP_version_max'], 1 + $extensionVersionRow['emconf_PHP_version_max'], + 1 ) : ''; $phpVersionMin = $extensionVersionRow['emconf_PHP_version_min'] > 0 ? versionConv( - $extensionVersionRow['emconf_PHP_version_min'], 1 + $extensionVersionRow['emconf_PHP_version_min'], + 1 ) : ''; $typo3VersionRange = (strlen($typo3VersionMin) && strlen($typo3VersionMax)) ? $typo3VersionMin . '-' . $typo3VersionMax : ''; @@ -222,7 +233,7 @@ function writeExtensionAndIconFile(&$extensionData, $filesData) foreach ($extensionData['technicalData']['dependencies'] as $dependencyArr) { switch ($dependencyArr['extensionKey']) { - case 'typo3' : + case 'typo3': $typo3Version = $dependencyArr['versionRange']; break; case 'php': @@ -304,14 +315,15 @@ function writeExtensionAndIconFile(&$extensionData, $filesData) } list ($majorVersion, $minorVersion, $devVersion) = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode( - '.', $extensionData['version'] + '.', + $extensionData['version'] ); $t3xFileName = strtolower( - $extensionData['extensionKey'] - ) . '_' . $majorVersion . '.' . $minorVersion . '.' . $devVersion . '.t3x'; + $extensionData['extensionKey'] + ) . '_' . $majorVersion . '.' . $minorVersion . '.' . $devVersion . '.t3x'; $gifFileName = strtolower( - $extensionData['extensionKey'] - ) . '_' . $majorVersion . '.' . $minorVersion . '.' . $devVersion . '.gif'; + $extensionData['extensionKey'] + ) . '_' . $majorVersion . '.' . $minorVersion . '.' . $devVersion . '.gif'; // Write the files $fh = @fopen($fullPath . $t3xFileName, 'wb'); @@ -340,9 +352,10 @@ function writeExtensionInfoToDB($accountData, $extensionData, $filesData, $exten // Add extension key to key table if we are processing the first version of the extension: if ($versionOfExtension == 1) { - $res = $TYPO3_DB->exec_SELECTquery( - '*', 'tx_extrep_keytable', 'extension_key = "' . $extensionData['extensionKey'] . '"' + '*', + 'tx_extrep_keytable', + 'extension_key = "' . $extensionData['extensionKey'] . '"' ); $oldExtensionKeyRow = $TYPO3_DB->sql_fetch_assoc($res); @@ -359,7 +372,8 @@ function writeExtensionInfoToDB($accountData, $extensionData, $filesData, $exten ]; $TYPO3_DB->exec_INSERTquery( - 'tx_ter_extensionkeys', $extensionKeyRow + 'tx_ter_extensionkeys', + $extensionKeyRow ); } @@ -424,7 +438,6 @@ function writeExtensionInfoToDB($accountData, $extensionData, $filesData, $exten ]; $TYPO3_DB->exec_INSERTquery('tx_ter_extensiondetails', $extensionDetailsRow); - } /** @@ -490,15 +503,18 @@ function writeExtensionIndexfile() global $TYPO3_DB; if (!@is_dir($GLOBALS['repositoryDir'])) { - throw new tx_ter_exception_internalServerError ( - 'Extension repository directory does not exist.', TX_TER_ERROR_GENERAL_EXTREPDIRDOESNTEXIST + throw new tx_ter_exception_internalServerError( + 'Extension repository directory does not exist.', + TX_TER_ERROR_GENERAL_EXTREPDIRDOESNTEXIST ); } $trackTime = microtime(); $res = $TYPO3_DB->exec_SELECTquery( - 'uid,tstamp,extensionkey,version,title,description,state,category,t3xfilemd5', 'tx_ter_extensions', '1' + 'uid,tstamp,extensionkey,version,title,description,state,category,t3xfilemd5', + 'tx_ter_extensions', + '1' ); // Read the extension records from the DB: @@ -506,14 +522,17 @@ function writeExtensionIndexfile() $extensionsTotalDownloadsArr = []; while ($row = $TYPO3_DB->sql_fetch_assoc($res)) { $res2 = $TYPO3_DB->exec_SELECTquery( - 'ownerusername,downloadcounter', 'tx_ter_extensionkeys', 'extensionkey="' . $row['extensionkey'] . '"' + 'ownerusername,downloadcounter', + 'tx_ter_extensionkeys', + 'extensionkey="' . $row['extensionkey'] . '"' ); $extensionKeyRow = $TYPO3_DB->sql_fetch_assoc($res2); $row['ownerusername'] = $extensionKeyRow['ownerusername']; $extensionsTotalDownloadsArr[$row['extensionkey']] = $extensionKeyRow['downloadcounter']; $res2 = $TYPO3_DB->exec_SELECTquery( - 'lastuploaddate,uploadcomment,dependencies,authorname,authoremail,authorcompany', 'tx_ter_extensiondetails', + 'lastuploaddate,uploadcomment,dependencies,authorname,authoremail,authorcompany', + 'tx_ter_extensiondetails', 'extensionuid=' . $row['uid'] ); $detailsRow = $TYPO3_DB->sql_fetch_assoc($res2); @@ -524,19 +543,19 @@ function writeExtensionIndexfile() } // Prepare the DOM object: - $dom = new DOMDocument ('1.0', 'utf-8'); + $dom = new DOMDocument('1.0', 'utf-8'); $dom->formatOutput = false; $extensionsObj = $dom->appendChild(new DOMElement('extensions')); // Create the nested XML structure: foreach ($extensionsAndVersionsArr as $extensionKey => $extensionVersionsArr) { $extensionObj = $extensionsObj->appendChild(new DOMElement('extension')); - $extensionObj->appendChild(new DOMAttr ('extensionkey', $extensionKey)); - $extensionObj->appendChild(new DOMElement ('downloadcounter', xmlentities($extensionsTotalDownloadsArr[$extensionKey]))); + $extensionObj->appendChild(new DOMAttr('extensionkey', $extensionKey)); + $extensionObj->appendChild(new DOMElement('downloadcounter', xmlentities($extensionsTotalDownloadsArr[$extensionKey]))); foreach ($extensionVersionsArr as $versionNumber => $extensionVersionArr) { $versionObj = $extensionObj->appendChild(new DOMElement('version')); - $versionObj->appendChild(new DOMAttr ('version', $versionNumber)); + $versionObj->appendChild(new DOMAttr('version', $versionNumber)); $versionObj->appendChild(new DOMElement('title', xmlentities($extensionVersionArr['title']))); $versionObj->appendChild(new DOMElement('description', xmlentities($extensionVersionArr['description']))); @@ -561,7 +580,7 @@ function writeExtensionIndexfile() // Write XML data to disc: $fh = fopen($GLOBALS['repositoryDir'] . 'cli-extensions.xml.gz', 'wb'); if (!$fh) { - throw new tx_ter_exception_internalServerError ( + throw new tx_ter_exception_internalServerError( 'Write error while writing extensions index file: ' . $GLOBALS['repositoryDir'] . 'extensions.xml', TX_TER_ERROR_UPLOADEXTENSION_WRITEERRORWHILEWRITINGEXTENSIONSINDEX ); @@ -570,8 +589,6 @@ function writeExtensionIndexfile() fclose($fh); #\TYPO3\CMS\Core\Utility\GeneralUtility::devLog('extensions','ter',0,$extensionsArr); - - } /** diff --git a/html/typo3conf/ext/ter/cli/process-extension-download-logs_cli.php b/html/typo3conf/ext/ter/cli/process-extension-download-logs_cli.php index e59a46149a6a77a31ed98fe3b245cb1616d306cc..6050c0d39702e747f224a45aae8639eccbe7b683 100644 --- a/html/typo3conf/ext/ter/cli/process-extension-download-logs_cli.php +++ b/html/typo3conf/ext/ter/cli/process-extension-download-logs_cli.php @@ -1,254 +1,320 @@ -#!/usr/local/php5/bin/php - - * @author Robert Lemke - * @package TYPO3 - * @subpackage tx_ter - */ - -define('TER_CLI_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR); -require_once(TER_CLI_PATH . '../resources/ezcomponents/Base/src/base.php'); - -/** - * Autoload ezc classes - * - * @param string $className - */ -function __autoload($className) -{ - ezcBase::autoload($className); -} - -$input = new ezcConsoleInput(); -$output = new ezcConsoleOutput(); - -$output->outputText(chr(10) . 'TER extension download logfile analyzer $Id$' . chr(10)); - -$options = [ - 'pathToTER' => $input->registerOption( - new ezcConsoleOption( - 't', 'terdirectory', ezcConsoleInput::TYPE_STRING, '/fileadmin/ter/', false, 'Relative path to the TER directory.', - 'Relative path to the TER directory. This directory must appear directly after the "GET" keyword in the access log files!', - [], [], true, false, false - ) - ), - 'username' => $input->registerOption( - new ezcConsoleOption( - 'u', 'username', ezcConsoleInput::TYPE_STRING, null, false, 'TER mirror username.', - 'A username of the TYPO3.org account which is member of the usergroup TER Mirrors.', [], [], true, true, false - ) - ), - 'password' => $input->registerOption( - new ezcConsoleOption( - 'p', 'password', ezcConsoleInput::TYPE_STRING, null, false, 'TER mirror password.', - 'The password of the TYPO3.org account which is member of the usergroup TER Mirrors.', [], [], true, true, false - ) - ), - 'logfile' => $input->registerOption( - new ezcConsoleOption( - 'l', 'logfile', ezcConsoleInput::TYPE_STRING, null, false, 'Path and filename of the logfile.', - 'Full path and filename of the Apache access logfile tracking extension downloads.', [], [], true, true, false - ) - ), - 'WSDLURI' => $input->registerOption( - new ezcConsoleOption( - 'w', 'wsdl', ezcConsoleInput::TYPE_STRING, 'http://repositories.typo3.org/wsdl/tx_ter_wsdl.php', false, 'WSDL URI', - 'The URI of the WSDL definition of the TER SOAP service. Use http://ter.dev.robertlemke.de/wsdl/tx_ter_wsdl.php for testing.', - [], [], true, false, false - ) - ), - 'dryrun' => $input->registerOption( - new ezcConsoleOption( - 'd', 'dry-run', ezcConsoleInput::TYPE_NONE, null, false, 'Dry run', - 'Dry run: The log file will be analyzed but the results are not uploaded to the TER. Instead the SOAP connection will be tested.', - [], [], false, false, false - ) - ), - 'help' => $input->registerOption( - new ezcConsoleOption( - 'h', 'help', ezcConsoleInput::TYPE_NONE, null, false, 'Help', 'Display a little help.', [], [], false, false, true - ) - ) -]; - -try { - $input->process(); -} catch (ezcConsoleOptionException $e) { - $output->outputText($e->getMessage() . chr(10) . chr(10), 'failure'); - die(); -} - -if ($options['help']->value !== false) { - $output->outputText($input->getHelpText('TER extension download logfile analyzer') . chr(10) . chr(10)); - exit(0); -} - -if (substr($options['pathToTER']->value, -1) != '/') { - $options['pathToTER']->value .= '/'; -} - -// Try to open the file corresponding to the argument - -$fp = fopen($options['logfile']->value, 'r'); - -// If the file can't be opened, issue error message and exit with status 2 - -if ($fp === false) { - $output->outputText('Could not open file ' . $options['logfile']->value . ' for reading' . "\n", 'failure'); - exit(2); -} - -// Assemble regular expression for t3x files path -// Path is of the form $options['pathToTER']->value/x/x/xx_yy_1.1.1.t3x -// Only the xx_yy_1.1.1 part and the log data coming after .t3x are captured by this regexp - -$t3xRegExp = '/GET ' . addcslashes($options['pathToTER']->value, '/') . '\w\/\w\/(.+?)\.t3x (.+)/'; - -// Initialise download counter and start parsing file line by line - -$downloadCounter = []; -while (!feof($fp)) { - $line = fgets($fp); - -// Consider only non-empty lines that contain a t3x entry - - if (!empty($line) && strpos($line, 't3x') !== false) { - -// Extract the actual extension key and version number - - $matches = []; - $result = preg_match($t3xRegExp, $line, $matches); - -// Extract HTTP return code -// (number of bytes transferred might also be extracted at a later point -// to compare with actual file size to check whether download was completed or not) -// A hit will be counted only on a succesful return code (200) - - $trailingLogData = explode(' ', substr($matches[2], strpos($matches[2], '"'))); - $returnCode = $trailingLogData[1]; - if ($returnCode == '200') { - -// Split string on last dash to get extension key and version number - - $extensionKey = substr($matches[1], 0, strrpos($matches[1], '_')); - $extensionVersion = substr($matches[1], strrpos($matches[1], '_') + 1); - -// Increment counter for each extension and each version of extension -// (so called "increase counter per version" :-) - - if (!isset($downloadCounter[$extensionKey])) { - $downloadCounter[$extensionKey] = []; - } - if (!isset($downloadCounter[$extensionKey][$extensionVersion])) { - $downloadCounter[$extensionKey][$extensionVersion] = 0; - } - $downloadCounter[$extensionKey][$extensionVersion]++; - } - } -} - -// Format download counter array for SOAP call to TER -$extensionVersionsAndIncrementors = []; -foreach ($downloadCounter as $extensionKey => $versionCounters) { - foreach ($versionCounters as $extensionVersion => $count) { - $extensionVersionsAndIncrementors[] = [ - 'extensionKey' => $extensionKey, - 'version' => $extensionVersion, - 'downloadCountIncrementor' => $count - ]; - } -} - -// SOAP call to TER -$wsdlData = file_get_contents($options['WSDLURI']->value); -file_put_contents('/tmp/typo3org_wsdl.xml', $wsdlData); -$soapClient = new SoapClient('/tmp/typo3org_wsdl.xml'); -if ($options['dryrun']->value !== false) { - $output->outputText('Dry run - checking the SOAP connection: '); - try { - $result = $soapClient->ping('soapcheck'); - } catch (tx_ter_exception $e) { - $output->outputText('failed' . chr(10), 'failure'); - $output->outputText($e->getMessage() . chr(10) . chr(10), 'failure'); - exit(3); - } - $output->outputText('success' . chr(10), 'success'); -} else { - $output->outputText('Uploading results via SOAP: '); - $accountData = ['username' => $options['username']->value, 'password' => $options['password']->value]; - try { - $result = $soapClient->increaseExtensionDownloadCounters($accountData, $extensionVersionsAndIncrementors); - } catch (tx_ter_exception $e) { - $output->outputText('failed' . chr(10), 'failure'); - $output->outputText($e->getMessage() . chr(10) . chr(10), 'failure'); - exit(3); - } - $output->outputText('success' . chr(10), 'success'); -} - -// Output a formatted view of the results -// This can be saved to a log file or just ignored - -$table = new ezcConsoleTable($output, 60); - -$table[0][0]->content = 'Extension key'; -$table[0][1]->content = 'Extension version'; -$table[0][2]->content = 'Count'; - -$tableRowCounter = 1; -ksort($downloadCounter); -foreach ($downloadCounter as $extensionKey => $versionCounters) { - ksort($versionCounters); - foreach ($versionCounters as $extensionVersion => $count) { - $table[$tableRowCounter][]->content = $extensionKey; - $table[$tableRowCounter][]->content = $extensionVersion; - $table[$tableRowCounter][]->content = $count; - $tableRowCounter++; - } -} -$table->outputTable(); - -// Close the file pointer -fclose($fp); - -echo("\n"); -?> +#!/usr/local/php5/bin/php + + * @author Robert Lemke + * @package TYPO3 + * @subpackage tx_ter + */ + +define('TER_CLI_PATH', dirname(__FILE__) . DIRECTORY_SEPARATOR); +require_once(TER_CLI_PATH . '../resources/ezcomponents/Base/src/base.php'); + +/** + * Autoload ezc classes + * + * @param string $className + */ +function __autoload($className) +{ + ezcBase::autoload($className); +} + +$input = new ezcConsoleInput(); +$output = new ezcConsoleOutput(); + +$output->outputText(chr(10) . 'TER extension download logfile analyzer $Id$' . chr(10)); + +$options = [ + 'pathToTER' => $input->registerOption( + new ezcConsoleOption( + 't', + 'terdirectory', + ezcConsoleInput::TYPE_STRING, + '/fileadmin/ter/', + false, + 'Relative path to the TER directory.', + 'Relative path to the TER directory. This directory must appear directly after the "GET" keyword in the access log files!', + [], + [], + true, + false, + false + ) + ), + 'username' => $input->registerOption( + new ezcConsoleOption( + 'u', + 'username', + ezcConsoleInput::TYPE_STRING, + null, + false, + 'TER mirror username.', + 'A username of the TYPO3.org account which is member of the usergroup TER Mirrors.', + [], + [], + true, + true, + false + ) + ), + 'password' => $input->registerOption( + new ezcConsoleOption( + 'p', + 'password', + ezcConsoleInput::TYPE_STRING, + null, + false, + 'TER mirror password.', + 'The password of the TYPO3.org account which is member of the usergroup TER Mirrors.', + [], + [], + true, + true, + false + ) + ), + 'logfile' => $input->registerOption( + new ezcConsoleOption( + 'l', + 'logfile', + ezcConsoleInput::TYPE_STRING, + null, + false, + 'Path and filename of the logfile.', + 'Full path and filename of the Apache access logfile tracking extension downloads.', + [], + [], + true, + true, + false + ) + ), + 'WSDLURI' => $input->registerOption( + new ezcConsoleOption( + 'w', + 'wsdl', + ezcConsoleInput::TYPE_STRING, + 'http://repositories.typo3.org/wsdl/tx_ter_wsdl.php', + false, + 'WSDL URI', + 'The URI of the WSDL definition of the TER SOAP service. Use http://ter.dev.robertlemke.de/wsdl/tx_ter_wsdl.php for testing.', + [], + [], + true, + false, + false + ) + ), + 'dryrun' => $input->registerOption( + new ezcConsoleOption( + 'd', + 'dry-run', + ezcConsoleInput::TYPE_NONE, + null, + false, + 'Dry run', + 'Dry run: The log file will be analyzed but the results are not uploaded to the TER. Instead the SOAP connection will be tested.', + [], + [], + false, + false, + false + ) + ), + 'help' => $input->registerOption( + new ezcConsoleOption( + 'h', + 'help', + ezcConsoleInput::TYPE_NONE, + null, + false, + 'Help', + 'Display a little help.', + [], + [], + false, + false, + true + ) + ) +]; + +try { + $input->process(); +} catch (ezcConsoleOptionException $e) { + $output->outputText($e->getMessage() . chr(10) . chr(10), 'failure'); + die(); +} + +if ($options['help']->value !== false) { + $output->outputText($input->getHelpText('TER extension download logfile analyzer') . chr(10) . chr(10)); + exit(0); +} + +if (substr($options['pathToTER']->value, -1) != '/') { + $options['pathToTER']->value .= '/'; +} + +// Try to open the file corresponding to the argument + +$fp = fopen($options['logfile']->value, 'r'); + +// If the file can't be opened, issue error message and exit with status 2 + +if ($fp === false) { + $output->outputText('Could not open file ' . $options['logfile']->value . ' for reading' . "\n", 'failure'); + exit(2); +} + +// Assemble regular expression for t3x files path +// Path is of the form $options['pathToTER']->value/x/x/xx_yy_1.1.1.t3x +// Only the xx_yy_1.1.1 part and the log data coming after .t3x are captured by this regexp + +$t3xRegExp = '/GET ' . addcslashes($options['pathToTER']->value, '/') . '\w\/\w\/(.+?)\.t3x (.+)/'; + +// Initialise download counter and start parsing file line by line + +$downloadCounter = []; +while (!feof($fp)) { + $line = fgets($fp); + +// Consider only non-empty lines that contain a t3x entry + + if (!empty($line) && strpos($line, 't3x') !== false) { +// Extract the actual extension key and version number + + $matches = []; + $result = preg_match($t3xRegExp, $line, $matches); + +// Extract HTTP return code +// (number of bytes transferred might also be extracted at a later point +// to compare with actual file size to check whether download was completed or not) +// A hit will be counted only on a succesful return code (200) + + $trailingLogData = explode(' ', substr($matches[2], strpos($matches[2], '"'))); + $returnCode = $trailingLogData[1]; + if ($returnCode == '200') { +// Split string on last dash to get extension key and version number + + $extensionKey = substr($matches[1], 0, strrpos($matches[1], '_')); + $extensionVersion = substr($matches[1], strrpos($matches[1], '_') + 1); + +// Increment counter for each extension and each version of extension +// (so called "increase counter per version" :-) + + if (!isset($downloadCounter[$extensionKey])) { + $downloadCounter[$extensionKey] = []; + } + if (!isset($downloadCounter[$extensionKey][$extensionVersion])) { + $downloadCounter[$extensionKey][$extensionVersion] = 0; + } + $downloadCounter[$extensionKey][$extensionVersion]++; + } + } +} + +// Format download counter array for SOAP call to TER +$extensionVersionsAndIncrementors = []; +foreach ($downloadCounter as $extensionKey => $versionCounters) { + foreach ($versionCounters as $extensionVersion => $count) { + $extensionVersionsAndIncrementors[] = [ + 'extensionKey' => $extensionKey, + 'version' => $extensionVersion, + 'downloadCountIncrementor' => $count + ]; + } +} + +// SOAP call to TER +$wsdlData = file_get_contents($options['WSDLURI']->value); +file_put_contents('/tmp/typo3org_wsdl.xml', $wsdlData); +$soapClient = new SoapClient('/tmp/typo3org_wsdl.xml'); +if ($options['dryrun']->value !== false) { + $output->outputText('Dry run - checking the SOAP connection: '); + try { + $result = $soapClient->ping('soapcheck'); + } catch (tx_ter_exception $e) { + $output->outputText('failed' . chr(10), 'failure'); + $output->outputText($e->getMessage() . chr(10) . chr(10), 'failure'); + exit(3); + } + $output->outputText('success' . chr(10), 'success'); +} else { + $output->outputText('Uploading results via SOAP: '); + $accountData = ['username' => $options['username']->value, 'password' => $options['password']->value]; + try { + $result = $soapClient->increaseExtensionDownloadCounters($accountData, $extensionVersionsAndIncrementors); + } catch (tx_ter_exception $e) { + $output->outputText('failed' . chr(10), 'failure'); + $output->outputText($e->getMessage() . chr(10) . chr(10), 'failure'); + exit(3); + } + $output->outputText('success' . chr(10), 'success'); +} + +// Output a formatted view of the results +// This can be saved to a log file or just ignored + +$table = new ezcConsoleTable($output, 60); + +$table[0][0]->content = 'Extension key'; +$table[0][1]->content = 'Extension version'; +$table[0][2]->content = 'Count'; + +$tableRowCounter = 1; +ksort($downloadCounter); +foreach ($downloadCounter as $extensionKey => $versionCounters) { + ksort($versionCounters); + foreach ($versionCounters as $extensionVersion => $count) { + $table[$tableRowCounter][]->content = $extensionKey; + $table[$tableRowCounter][]->content = $extensionVersion; + $table[$tableRowCounter][]->content = $count; + $tableRowCounter++; + } +} +$table->outputTable(); + +// Close the file pointer +fclose($fp); + +echo("\n"); +?> diff --git a/html/typo3conf/ext/ter/cli/setreviewstates_cli.php b/html/typo3conf/ext/ter/cli/setreviewstates_cli.php index f399de30e949c4091a445e8201fc9e2a76748acf..67e2e9c2a0319f30d1148bc4483ec4b87468e84d 100755 --- a/html/typo3conf/ext/ter/cli/setreviewstates_cli.php +++ b/html/typo3conf/ext/ter/cli/setreviewstates_cli.php @@ -25,13 +25,15 @@ require(dirname(PATH_thisScript) . '/' . $BACK_PATH . 'init.php'); $res = $TYPO3_DB->exec_SELECTquery( - 'extensionkey,version', 'tx_ter_extensions', '1' + 'extensionkey,version', + 'tx_ter_extensions', + '1' ); while ($extensionRow = $TYPO3_DB->sql_fetch_assoc($res)) { - $res2 = $TYPO3_DB->exec_SELECTquery( - 'rating', 'tx_terfe_reviewratings', + 'rating', + 'tx_terfe_reviewratings', 'extensionkey="' . $extensionRow['extensionkey'] . '" AND version="' . $extensionRow['version'] . '"' ); diff --git a/html/typo3conf/ext/ter/exception/class.tx_ter_exception_internalServerError.php b/html/typo3conf/ext/ter/exception/class.tx_ter_exception_internalServerError.php index 092df1b07dd905dd9ddb94b0679ffeac502d0fce..f6100fb0ebf19879aeae386d25583856a22f7a93 100644 --- a/html/typo3conf/ext/ter/exception/class.tx_ter_exception_internalServerError.php +++ b/html/typo3conf/ext/ter/exception/class.tx_ter_exception_internalServerError.php @@ -17,4 +17,4 @@ */ class tx_ter_exception_internalServerError extends tx_ter_exception { -} \ No newline at end of file +} diff --git a/html/typo3conf/ext/ter/exception/class.tx_ter_exception_notFound.php b/html/typo3conf/ext/ter/exception/class.tx_ter_exception_notFound.php index 16cc249966a3c88f191237cb452d628d796717a6..f455c92d9eff70370e34394ab91294e3c617fd08 100644 --- a/html/typo3conf/ext/ter/exception/class.tx_ter_exception_notFound.php +++ b/html/typo3conf/ext/ter/exception/class.tx_ter_exception_notFound.php @@ -18,4 +18,4 @@ */ class tx_ter_exception_notFound extends tx_ter_exception { -} \ No newline at end of file +} diff --git a/html/typo3conf/ext/ter/exception/class.tx_ter_exception_unauthorized.php b/html/typo3conf/ext/ter/exception/class.tx_ter_exception_unauthorized.php index 88bacf1facfe7a16656f10f67d1e0cfe89e0547d..9da499d163b0debd369cbe17b97926fe4eab90eb 100644 --- a/html/typo3conf/ext/ter/exception/class.tx_ter_exception_unauthorized.php +++ b/html/typo3conf/ext/ter/exception/class.tx_ter_exception_unauthorized.php @@ -17,4 +17,4 @@ */ class tx_ter_exception_unauthorized extends tx_ter_exception { -} \ No newline at end of file +} diff --git a/html/typo3conf/ext/ter/ext_autoload.php b/html/typo3conf/ext/ter/ext_autoload.php index 63610420d61a1f3d86c40e55955d09b22a596ee7..d23bb0563dc07739bdeafb5139300bc8b17eb952 100755 --- a/html/typo3conf/ext/ter/ext_autoload.php +++ b/html/typo3conf/ext/ter/ext_autoload.php @@ -2,19 +2,18 @@ $extensionPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('ter'); return [ - 'tx_ter_api' => $extensionPath . 'class.tx_ter_api.php', - 'tx_ter_helper' => $extensionPath . 'class.tx_ter_helper.php', - 'tx_ter_buildextensionindex' => $extensionPath . 'cli/build-extension-index.php', - 'tx_ter_module1' => $extensionPath . 'mod1/index.php', - 'tx_ter_pi1' => $extensionPath . 'pi1/class.tx_ter_pi1.php', - 'tx_ter_updatecurrentversionlisttask' => $extensionPath . 'task/class.tx_ter_updateCurrentVersionListTask.php', - 'tx_ter_updateextensionindextask' => $extensionPath . 'task/class.tx_ter_updateExtensionIndexTask.php', - 'tx_ter_updateextensionindextask_additionalfieldprovider' => $extensionPath . 'task/class.tx_ter_updateExtensionIndexTask_additionalFieldProvider.php', - 'tx_ter_exception' => $extensionPath . 'class.tx_ter_exception.php', - 'tx_ter_exception_unauthorized' => $extensionPath . 'exception/class.tx_ter_exception_unauthorized.php', - 'tx_ter_exception_faileddependency' => $extensionPath . 'exception/class.tx_ter_exception_failedDependency.php', - 'tx_ter_exception_versionexists' => $extensionPath . 'exception/class.tx_ter_exception_versionExists.php', - 'tx_ter_exception_internalservererror' => $extensionPath . 'exception/class.tx_ter_exception_internalServerError.php', - 'tx_ter_exception_notfound' => $extensionPath . 'exception/class.tx_ter_exception_notFound.php', + 'tx_ter_api' => $extensionPath . 'class.tx_ter_api.php', + 'tx_ter_helper' => $extensionPath . 'class.tx_ter_helper.php', + 'tx_ter_buildextensionindex' => $extensionPath . 'cli/build-extension-index.php', + 'tx_ter_module1' => $extensionPath . 'mod1/index.php', + 'tx_ter_pi1' => $extensionPath . 'pi1/class.tx_ter_pi1.php', + 'tx_ter_updatecurrentversionlisttask' => $extensionPath . 'task/class.tx_ter_updateCurrentVersionListTask.php', + 'tx_ter_updateextensionindextask' => $extensionPath . 'task/class.tx_ter_updateExtensionIndexTask.php', + 'tx_ter_updateextensionindextask_additionalfieldprovider' => $extensionPath . 'task/class.tx_ter_updateExtensionIndexTask_additionalFieldProvider.php', + 'tx_ter_exception' => $extensionPath . 'class.tx_ter_exception.php', + 'tx_ter_exception_unauthorized' => $extensionPath . 'exception/class.tx_ter_exception_unauthorized.php', + 'tx_ter_exception_faileddependency' => $extensionPath . 'exception/class.tx_ter_exception_failedDependency.php', + 'tx_ter_exception_versionexists' => $extensionPath . 'exception/class.tx_ter_exception_versionExists.php', + 'tx_ter_exception_internalservererror' => $extensionPath . 'exception/class.tx_ter_exception_internalServerError.php', + 'tx_ter_exception_notfound' => $extensionPath . 'exception/class.tx_ter_exception_notFound.php', ]; -?> diff --git a/html/typo3conf/ext/ter/ext_emconf.php b/html/typo3conf/ext/ter/ext_emconf.php index 60dfaea2963919bd90bbb9c9c03f5066d433cb4c..915f4c6c84c48f039cc7d7f38c82b5ea0b32ed28 100755 --- a/html/typo3conf/ext/ter/ext_emconf.php +++ b/html/typo3conf/ext/ter/ext_emconf.php @@ -11,34 +11,32 @@ ######################################################################## $EM_CONF[$_EXTKEY] = [ - 'title' => 'TYPO3 Extension Repository', - 'description' => 'SOAP-based server module for the TYPO3 Extension Repository (TER).', - 'category' => 'misc', - 'author' => 'Robert Lemke', - 'author_email' => 'robert@typo3.org', - 'shy' => '', - 'dependencies' => 'saltedpasswords', - 'conflicts' => '', - 'priority' => '', - 'module' => '', - 'state' => 'stable', - 'internal' => '', - 'uploadfolder' => 0, - 'createDirs' => '', - 'modify_tables' => '', - 'clearCacheOnLoad' => 0, - 'lockType' => '', - 'author_company' => 'TYPO3 Association', - 'version' => '2.0.9', - '_md5_values_when_last_written' => 'a:203:{s:9:"ChangeLog";s:4:"7da8";s:20:"class.tx_ter_api.php";s:4:"372f";s:23:"class.tx_ter_helper.php";s:4:"7904";s:21:"ext_conf_template.txt";s:4:"0af8";s:12:"ext_icon.gif";s:4:"fa7d";s:17:"ext_localconf.php";s:4:"648c";s:14:"ext_tables.php";s:4:"9d3e";s:14:"ext_tables.sql";s:4:"9d59";s:24:"ext_typoscript_setup.txt";s:4:"cf02";s:17:"locallang_tca.php";s:4:"c8fa";s:7:"tca.php";s:4:"5d5b";s:11:"tx_ter.wsdl";s:4:"338e";s:24:"tx_ter_extensionkeys.gif";s:4:"de2f";s:15:"tx_ter_wsdl.php";s:4:"3a09";s:29:"cli/build-extension-index.php";s:4:"7150";s:12:"cli/conf.php";s:4:"e1b6";s:26:"cli/fix-uploadcomments.php";s:4:"f9bb";s:28:"cli/import-from-ter1_cli.php";s:4:"d8e3";s:43:"cli/process-extension-download-logs_cli.php";s:4:"bfe1";s:27:"cli/setreviewstates_cli.php";s:4:"8f4c";s:13:"doc/NOTES.txt";s:4:"553e";s:14:"doc/manual.sxw";s:4:"a026";s:14:"mod1/clear.gif";s:4:"cc11";s:13:"mod1/conf.php";s:4:"51ad";s:14:"mod1/index.php";s:4:"3ecb";s:18:"mod1/locallang.php";s:4:"4ed5";s:22:"mod1/locallang_mod.php";s:4:"6bb1";s:19:"mod1/moduleicon.gif";s:4:"8074";s:24:"pi1/class.tx_ter_pi1.php";s:4:"7b92";s:17:"pi1/locallang.php";s:4:"33ab";s:35:"resources/ezcomponents/Base/CREDITS";s:4:"be81";s:37:"resources/ezcomponents/Base/ChangeLog";s:4:"344a";s:39:"resources/ezcomponents/Base/DESCRIPTION";s:4:"5d5e";s:45:"resources/ezcomponents/Base/docs/tutorial.txt";s:4:"66ae";s:54:"resources/ezcomponents/Base/docs/tutorial_autoload.php";s:4:"18f9";s:56:"resources/ezcomponents/Base/docs/tutorial_example_01.php";s:4:"d368";s:54:"resources/ezcomponents/Base/docs/repos/Me/myclass1.php";s:4:"0890";s:54:"resources/ezcomponents/Base/docs/repos/Me/myclass2.php";s:4:"f035";s:57:"resources/ezcomponents/Base/docs/repos/You/yourclass1.php";s:4:"048a";s:57:"resources/ezcomponents/Base/docs/repos/You/yourclass2.php";s:4:"74d5";s:64:"resources/ezcomponents/Base/docs/repos/autoloads/my_autoload.php";s:4:"d0af";s:66:"resources/ezcomponents/Base/docs/repos/autoloads/your_autoload.php";s:4:"5a9c";s:40:"resources/ezcomponents/Base/src/base.php";s:4:"bfce";s:49:"resources/ezcomponents/Base/src/base_autoload.php";s:4:"1e2a";s:43:"resources/ezcomponents/Base/src/options.php";s:4:"857e";s:42:"resources/ezcomponents/Base/src/struct.php";s:4:"4e88";s:56:"resources/ezcomponents/Base/src/exceptions/exception.php";s:4:"ea20";s:61:"resources/ezcomponents/Base/src/exceptions/file_exception.php";s:4:"1c71";s:54:"resources/ezcomponents/Base/src/exceptions/file_io.php";s:4:"3429";s:61:"resources/ezcomponents/Base/src/exceptions/file_not_found.php";s:4:"6618";s:62:"resources/ezcomponents/Base/src/exceptions/file_permission.php";s:4:"b6e7";s:65:"resources/ezcomponents/Base/src/exceptions/property_not_found.php";s:4:"a11f";s:66:"resources/ezcomponents/Base/src/exceptions/property_permission.php";s:4:"7891";s:64:"resources/ezcomponents/Base/src/exceptions/setting_not_found.php";s:4:"e711";s:60:"resources/ezcomponents/Base/src/exceptions/setting_value.php";s:4:"7781";s:52:"resources/ezcomponents/Base/src/exceptions/value.php";s:4:"6c0e";s:55:"resources/ezcomponents/Base/src/exceptions/whatever.php";s:4:"b1f8";s:47:"resources/ezcomponents/Base/tests/base_test.php";s:4:"f377";s:43:"resources/ezcomponents/Base/tests/suite.php";s:4:"0533";s:81:"resources/ezcomponents/Base/tests/test_repository/TestClasses/base_test_class.php";s:4:"84cd";s:92:"resources/ezcomponents/Base/tests/test_repository/TestClasses/base_test_class_number_two.php";s:4:"b233";s:86:"resources/ezcomponents/Base/tests/test_repository/autoload_files/basetest_autoload.php";s:4:"aef9";s:84:"resources/ezcomponents/Base/tests/test_repository/autoload_files/object_autoload.php";s:4:"f681";s:67:"resources/ezcomponents/Base/tests/test_repository/object/object.php";s:4:"dfda";s:43:"resources/ezcomponents/ConsoleTools/CREDITS";s:4:"be81";s:45:"resources/ezcomponents/ConsoleTools/ChangeLog";s:4:"a8de";s:47:"resources/ezcomponents/ConsoleTools/DESCRIPTION";s:4:"d49e";s:40:"resources/ezcomponents/ConsoleTools/TODO";s:4:"f0fa";s:58:"resources/ezcomponents/ConsoleTools/docs/example_input.php";s:4:"0b08";s:59:"resources/ezcomponents/ConsoleTools/docs/example_output.php";s:4:"25ae";s:64:"resources/ezcomponents/ConsoleTools/docs/example_progressbar.php";s:4:"9507";s:68:"resources/ezcomponents/ConsoleTools/docs/example_progressmonitor.php";s:4:"bb43";s:62:"resources/ezcomponents/ConsoleTools/docs/example_statusbar.php";s:4:"b1d7";s:58:"resources/ezcomponents/ConsoleTools/docs/example_table.php";s:4:"d358";s:60:"resources/ezcomponents/ConsoleTools/docs/example_table_2.php";s:4:"2f7b";s:53:"resources/ezcomponents/ConsoleTools/docs/tutorial.txt";s:4:"6dce";s:62:"resources/ezcomponents/ConsoleTools/docs/tutorial_autoload.php";s:4:"18f9";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_01.php";s:4:"fb9e";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_02.php";s:4:"6a12";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_03.php";s:4:"847a";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_04.php";s:4:"b069";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_05.php";s:4:"b1c4";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_06.php";s:4:"4cbc";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_07.php";s:4:"af78";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_08.php";s:4:"fb8a";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_09.php";s:4:"b7bb";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_10.php";s:4:"8b27";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_11.php";s:4:"c2b5";s:81:"resources/ezcomponents/ConsoleTools/docs/img/consoletools_tutorial_example_06.png";s:4:"e3f4";s:81:"resources/ezcomponents/ConsoleTools/docs/img/consoletools_tutorial_example_07.png";s:4:"9ef8";s:81:"resources/ezcomponents/ConsoleTools/docs/img/consoletools_tutorial_example_08.png";s:4:"3be4";s:81:"resources/ezcomponents/ConsoleTools/docs/img/consoletools_tutorial_example_09.png";s:4:"37c3";s:81:"resources/ezcomponents/ConsoleTools/docs/img/consoletools_tutorial_example_10.png";s:4:"4375";s:60:"resources/ezcomponents/ConsoleTools/src/console_autoload.php";s:4:"4ae0";s:49:"resources/ezcomponents/ConsoleTools/src/input.php";s:4:"903b";s:50:"resources/ezcomponents/ConsoleTools/src/output.php";s:4:"2afb";s:55:"resources/ezcomponents/ConsoleTools/src/progressbar.php";s:4:"07c3";s:59:"resources/ezcomponents/ConsoleTools/src/progressmonitor.php";s:4:"5311";s:53:"resources/ezcomponents/ConsoleTools/src/statusbar.php";s:4:"2088";s:49:"resources/ezcomponents/ConsoleTools/src/table.php";s:4:"de32";s:64:"resources/ezcomponents/ConsoleTools/src/exceptions/exception.php";s:4:"0791";s:74:"resources/ezcomponents/ConsoleTools/src/exceptions/invalid_option_name.php";s:4:"0d7e";s:73:"resources/ezcomponents/ConsoleTools/src/exceptions/no_position_stored.php";s:4:"4a18";s:61:"resources/ezcomponents/ConsoleTools/src/exceptions/option.php";s:4:"a846";s:80:"resources/ezcomponents/ConsoleTools/src/exceptions/option_already_registered.php";s:4:"150a";s:81:"resources/ezcomponents/ConsoleTools/src/exceptions/option_arguments_violation.php";s:4:"fc9b";s:82:"resources/ezcomponents/ConsoleTools/src/exceptions/option_dependency_violation.php";s:4:"7cbd";s:81:"resources/ezcomponents/ConsoleTools/src/exceptions/option_exclusion_violation.php";s:4:"a7d6";s:81:"resources/ezcomponents/ConsoleTools/src/exceptions/option_mandatory_violation.php";s:4:"7f1f";s:75:"resources/ezcomponents/ConsoleTools/src/exceptions/option_missing_value.php";s:4:"9889";s:70:"resources/ezcomponents/ConsoleTools/src/exceptions/option_no_alias.php";s:4:"7f94";s:72:"resources/ezcomponents/ConsoleTools/src/exceptions/option_not_exists.php";s:4:"85ad";s:83:"resources/ezcomponents/ConsoleTools/src/exceptions/option_string_not_wellformed.php";s:4:"05c1";s:77:"resources/ezcomponents/ConsoleTools/src/exceptions/option_too_many_values.php";s:4:"90a2";s:76:"resources/ezcomponents/ConsoleTools/src/exceptions/option_type_violation.php";s:4:"77c3";s:56:"resources/ezcomponents/ConsoleTools/src/input/option.php";s:4:"de4d";s:58:"resources/ezcomponents/ConsoleTools/src/options/output.php";s:4:"c224";s:63:"resources/ezcomponents/ConsoleTools/src/options/progressbar.php";s:4:"fecd";s:67:"resources/ezcomponents/ConsoleTools/src/options/progressmonitor.php";s:4:"ac4f";s:61:"resources/ezcomponents/ConsoleTools/src/options/statusbar.php";s:4:"a4ee";s:57:"resources/ezcomponents/ConsoleTools/src/options/table.php";s:4:"4dc4";s:63:"resources/ezcomponents/ConsoleTools/src/structs/option_rule.php";s:4:"db5d";s:65:"resources/ezcomponents/ConsoleTools/src/structs/output_format.php";s:4:"73d3";s:66:"resources/ezcomponents/ConsoleTools/src/structs/output_formats.php";s:4:"b11d";s:54:"resources/ezcomponents/ConsoleTools/src/table/cell.php";s:4:"3225";s:53:"resources/ezcomponents/ConsoleTools/src/table/row.php";s:4:"1ef7";s:56:"resources/ezcomponents/ConsoleTools/tests/input_test.php";s:4:"5b40";s:62:"resources/ezcomponents/ConsoleTools/tests/option_rule_test.php";s:4:"1211";s:57:"resources/ezcomponents/ConsoleTools/tests/option_test.php";s:4:"f17f";s:64:"resources/ezcomponents/ConsoleTools/tests/output_format_test.php";s:4:"7fa9";s:65:"resources/ezcomponents/ConsoleTools/tests/output_formats_test.php";s:4:"aa04";s:65:"resources/ezcomponents/ConsoleTools/tests/output_options_test.php";s:4:"2a16";s:57:"resources/ezcomponents/ConsoleTools/tests/output_test.php";s:4:"ff39";s:70:"resources/ezcomponents/ConsoleTools/tests/progressbar_options_test.php";s:4:"7b73";s:62:"resources/ezcomponents/ConsoleTools/tests/progressbar_test.php";s:4:"dc66";s:74:"resources/ezcomponents/ConsoleTools/tests/progressmonitor_options_test.php";s:4:"97cf";s:66:"resources/ezcomponents/ConsoleTools/tests/progressmonitor_test.php";s:4:"218b";s:68:"resources/ezcomponents/ConsoleTools/tests/statusbar_options_test.php";s:4:"9b97";s:60:"resources/ezcomponents/ConsoleTools/tests/statusbar_test.php";s:4:"87ac";s:51:"resources/ezcomponents/ConsoleTools/tests/suite.php";s:4:"880b";s:61:"resources/ezcomponents/ConsoleTools/tests/table_cell_test.php";s:4:"b2b7";s:64:"resources/ezcomponents/ConsoleTools/tests/table_options_test.php";s:4:"fecf";s:60:"resources/ezcomponents/ConsoleTools/tests/table_row_test.php";s:4:"0534";s:56:"resources/ezcomponents/ConsoleTools/tests/table_test.php";s:4:"eea5";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress1.dat";s:4:"9165";s:65:"resources/ezcomponents/ConsoleTools/tests/data/testProgress10.dat";s:4:"5603";s:65:"resources/ezcomponents/ConsoleTools/tests/data/testProgress11.dat";s:4:"7127";s:65:"resources/ezcomponents/ConsoleTools/tests/data/testProgress12.dat";s:4:"461a";s:65:"resources/ezcomponents/ConsoleTools/tests/data/testProgress13.dat";s:4:"1255";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress2.dat";s:4:"f3d2";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress3.dat";s:4:"4668";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress4.dat";s:4:"b5d5";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress5.dat";s:4:"1bd7";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress6.dat";s:4:"8c5b";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress7.dat";s:4:"a4ea";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress8.dat";s:4:"7ad3";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress9.dat";s:4:"dd57";s:71:"resources/ezcomponents/ConsoleTools/tests/data/testProgressMonitor1.dat";s:4:"01d7";s:71:"resources/ezcomponents/ConsoleTools/tests/data/testProgressMonitor2.dat";s:4:"f23f";s:71:"resources/ezcomponents/ConsoleTools/tests/data/testProgressMonitor3.dat";s:4:"1757";s:71:"resources/ezcomponents/ConsoleTools/tests/data/testProgressMonitor4.dat";s:4:"fb52";s:65:"resources/ezcomponents/ConsoleTools/tests/data/testStatusbar1.dat";s:4:"11ef";s:65:"resources/ezcomponents/ConsoleTools/tests/data/testStatusbar2.dat";s:4:"7fc6";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable1a.dat";s:4:"8baa";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable1b.dat";s:4:"fb66";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable2a.dat";s:4:"e443";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable2b.dat";s:4:"1621";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable3a.dat";s:4:"79c3";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable3b.dat";s:4:"d73c";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable4a.dat";s:4:"7bb9";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable4b.dat";s:4:"36ac";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable4c.dat";s:4:"7bb9";s:71:"resources/ezcomponents/ConsoleTools/tests/data/testTableColPadding1.dat";s:4:"fa54";s:71:"resources/ezcomponents/ConsoleTools/tests/data/testTableColPadding2.dat";s:4:"dac6";s:52:"resources/ezcomponents/autoload/archive_autoload.php";s:4:"f642";s:49:"resources/ezcomponents/autoload/base_autoload.php";s:4:"1e2a";s:50:"resources/ezcomponents/autoload/cache_autoload.php";s:4:"dfb0";s:58:"resources/ezcomponents/autoload/configuration_autoload.php";s:4:"72da";s:52:"resources/ezcomponents/autoload/console_autoload.php";s:4:"4ae0";s:47:"resources/ezcomponents/autoload/db_autoload.php";s:4:"078b";s:54:"resources/ezcomponents/autoload/db_schema_autoload.php";s:4:"03c5";s:50:"resources/ezcomponents/autoload/debug_autoload.php";s:4:"9f39";s:54:"resources/ezcomponents/autoload/execution_autoload.php";s:4:"478d";s:49:"resources/ezcomponents/autoload/file_autoload.php";s:4:"c067";s:59:"resources/ezcomponents/autoload/image_analyzer_autoload.php";s:4:"e19e";s:50:"resources/ezcomponents/autoload/image_autoload.php";s:4:"81c8";s:50:"resources/ezcomponents/autoload/input_autoload.php";s:4:"cc92";s:48:"resources/ezcomponents/autoload/log_autoload.php";s:4:"f8cb";s:57:"resources/ezcomponents/autoload/log_database_autoload.php";s:4:"bc4f";s:49:"resources/ezcomponents/autoload/mail_autoload.php";s:4:"64b2";s:55:"resources/ezcomponents/autoload/persistent_autoload.php";s:4:"952d";s:62:"resources/ezcomponents/autoload/persistent_object_autoload.php";s:4:"937f";s:58:"resources/ezcomponents/autoload/php_generator_autoload.php";s:4:"f41e";s:50:"resources/ezcomponents/autoload/query_autoload.php";s:4:"b931";s:51:"resources/ezcomponents/autoload/system_autoload.php";s:4:"976e";s:53:"resources/ezcomponents/autoload/template_autoload.php";s:4:"a82f";s:56:"resources/ezcomponents/autoload/translation_autoload.php";s:4:"d56e";s:62:"resources/ezcomponents/autoload/translation_cache_autoload.php";s:4:"4ed0";s:36:"tests/tx_ter_api_direct_testcase.php";s:4:"f6f7";s:32:"tests/tx_ter_helper_testcase.php";s:4:"0cd2";s:30:"tests/tx_ter_soap_testcase.php";s:4:"279f";s:52:"tests/fixtures/fixture_extuploaddataarray_zipped.dat";s:4:"e6c2";s:42:"tests/fixtures/special_characters_utf8.txt";s:4:"14cc";}', - 'constraints' => [ - 'depends' => [ - 'saltedpasswords' => '', - ], - 'conflicts' => [], - 'suggests' => [], - ], - 'suggests' => [], + 'title' => 'TYPO3 Extension Repository', + 'description' => 'SOAP-based server module for the TYPO3 Extension Repository (TER).', + 'category' => 'misc', + 'author' => 'Robert Lemke', + 'author_email' => 'robert@typo3.org', + 'shy' => '', + 'dependencies' => 'saltedpasswords', + 'conflicts' => '', + 'priority' => '', + 'module' => '', + 'state' => 'stable', + 'internal' => '', + 'uploadfolder' => 0, + 'createDirs' => '', + 'modify_tables' => '', + 'clearCacheOnLoad' => 0, + 'lockType' => '', + 'author_company' => 'TYPO3 Association', + 'version' => '2.0.9', + '_md5_values_when_last_written' => 'a:203:{s:9:"ChangeLog";s:4:"7da8";s:20:"class.tx_ter_api.php";s:4:"372f";s:23:"class.tx_ter_helper.php";s:4:"7904";s:21:"ext_conf_template.txt";s:4:"0af8";s:12:"ext_icon.gif";s:4:"fa7d";s:17:"ext_localconf.php";s:4:"648c";s:14:"ext_tables.php";s:4:"9d3e";s:14:"ext_tables.sql";s:4:"9d59";s:24:"ext_typoscript_setup.txt";s:4:"cf02";s:17:"locallang_tca.php";s:4:"c8fa";s:7:"tca.php";s:4:"5d5b";s:11:"tx_ter.wsdl";s:4:"338e";s:24:"tx_ter_extensionkeys.gif";s:4:"de2f";s:15:"tx_ter_wsdl.php";s:4:"3a09";s:29:"cli/build-extension-index.php";s:4:"7150";s:12:"cli/conf.php";s:4:"e1b6";s:26:"cli/fix-uploadcomments.php";s:4:"f9bb";s:28:"cli/import-from-ter1_cli.php";s:4:"d8e3";s:43:"cli/process-extension-download-logs_cli.php";s:4:"bfe1";s:27:"cli/setreviewstates_cli.php";s:4:"8f4c";s:13:"doc/NOTES.txt";s:4:"553e";s:14:"doc/manual.sxw";s:4:"a026";s:14:"mod1/clear.gif";s:4:"cc11";s:13:"mod1/conf.php";s:4:"51ad";s:14:"mod1/index.php";s:4:"3ecb";s:18:"mod1/locallang.php";s:4:"4ed5";s:22:"mod1/locallang_mod.php";s:4:"6bb1";s:19:"mod1/moduleicon.gif";s:4:"8074";s:24:"pi1/class.tx_ter_pi1.php";s:4:"7b92";s:17:"pi1/locallang.php";s:4:"33ab";s:35:"resources/ezcomponents/Base/CREDITS";s:4:"be81";s:37:"resources/ezcomponents/Base/ChangeLog";s:4:"344a";s:39:"resources/ezcomponents/Base/DESCRIPTION";s:4:"5d5e";s:45:"resources/ezcomponents/Base/docs/tutorial.txt";s:4:"66ae";s:54:"resources/ezcomponents/Base/docs/tutorial_autoload.php";s:4:"18f9";s:56:"resources/ezcomponents/Base/docs/tutorial_example_01.php";s:4:"d368";s:54:"resources/ezcomponents/Base/docs/repos/Me/myclass1.php";s:4:"0890";s:54:"resources/ezcomponents/Base/docs/repos/Me/myclass2.php";s:4:"f035";s:57:"resources/ezcomponents/Base/docs/repos/You/yourclass1.php";s:4:"048a";s:57:"resources/ezcomponents/Base/docs/repos/You/yourclass2.php";s:4:"74d5";s:64:"resources/ezcomponents/Base/docs/repos/autoloads/my_autoload.php";s:4:"d0af";s:66:"resources/ezcomponents/Base/docs/repos/autoloads/your_autoload.php";s:4:"5a9c";s:40:"resources/ezcomponents/Base/src/base.php";s:4:"bfce";s:49:"resources/ezcomponents/Base/src/base_autoload.php";s:4:"1e2a";s:43:"resources/ezcomponents/Base/src/options.php";s:4:"857e";s:42:"resources/ezcomponents/Base/src/struct.php";s:4:"4e88";s:56:"resources/ezcomponents/Base/src/exceptions/exception.php";s:4:"ea20";s:61:"resources/ezcomponents/Base/src/exceptions/file_exception.php";s:4:"1c71";s:54:"resources/ezcomponents/Base/src/exceptions/file_io.php";s:4:"3429";s:61:"resources/ezcomponents/Base/src/exceptions/file_not_found.php";s:4:"6618";s:62:"resources/ezcomponents/Base/src/exceptions/file_permission.php";s:4:"b6e7";s:65:"resources/ezcomponents/Base/src/exceptions/property_not_found.php";s:4:"a11f";s:66:"resources/ezcomponents/Base/src/exceptions/property_permission.php";s:4:"7891";s:64:"resources/ezcomponents/Base/src/exceptions/setting_not_found.php";s:4:"e711";s:60:"resources/ezcomponents/Base/src/exceptions/setting_value.php";s:4:"7781";s:52:"resources/ezcomponents/Base/src/exceptions/value.php";s:4:"6c0e";s:55:"resources/ezcomponents/Base/src/exceptions/whatever.php";s:4:"b1f8";s:47:"resources/ezcomponents/Base/tests/base_test.php";s:4:"f377";s:43:"resources/ezcomponents/Base/tests/suite.php";s:4:"0533";s:81:"resources/ezcomponents/Base/tests/test_repository/TestClasses/base_test_class.php";s:4:"84cd";s:92:"resources/ezcomponents/Base/tests/test_repository/TestClasses/base_test_class_number_two.php";s:4:"b233";s:86:"resources/ezcomponents/Base/tests/test_repository/autoload_files/basetest_autoload.php";s:4:"aef9";s:84:"resources/ezcomponents/Base/tests/test_repository/autoload_files/object_autoload.php";s:4:"f681";s:67:"resources/ezcomponents/Base/tests/test_repository/object/object.php";s:4:"dfda";s:43:"resources/ezcomponents/ConsoleTools/CREDITS";s:4:"be81";s:45:"resources/ezcomponents/ConsoleTools/ChangeLog";s:4:"a8de";s:47:"resources/ezcomponents/ConsoleTools/DESCRIPTION";s:4:"d49e";s:40:"resources/ezcomponents/ConsoleTools/TODO";s:4:"f0fa";s:58:"resources/ezcomponents/ConsoleTools/docs/example_input.php";s:4:"0b08";s:59:"resources/ezcomponents/ConsoleTools/docs/example_output.php";s:4:"25ae";s:64:"resources/ezcomponents/ConsoleTools/docs/example_progressbar.php";s:4:"9507";s:68:"resources/ezcomponents/ConsoleTools/docs/example_progressmonitor.php";s:4:"bb43";s:62:"resources/ezcomponents/ConsoleTools/docs/example_statusbar.php";s:4:"b1d7";s:58:"resources/ezcomponents/ConsoleTools/docs/example_table.php";s:4:"d358";s:60:"resources/ezcomponents/ConsoleTools/docs/example_table_2.php";s:4:"2f7b";s:53:"resources/ezcomponents/ConsoleTools/docs/tutorial.txt";s:4:"6dce";s:62:"resources/ezcomponents/ConsoleTools/docs/tutorial_autoload.php";s:4:"18f9";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_01.php";s:4:"fb9e";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_02.php";s:4:"6a12";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_03.php";s:4:"847a";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_04.php";s:4:"b069";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_05.php";s:4:"b1c4";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_06.php";s:4:"4cbc";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_07.php";s:4:"af78";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_08.php";s:4:"fb8a";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_09.php";s:4:"b7bb";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_10.php";s:4:"8b27";s:64:"resources/ezcomponents/ConsoleTools/docs/tutorial_example_11.php";s:4:"c2b5";s:81:"resources/ezcomponents/ConsoleTools/docs/img/consoletools_tutorial_example_06.png";s:4:"e3f4";s:81:"resources/ezcomponents/ConsoleTools/docs/img/consoletools_tutorial_example_07.png";s:4:"9ef8";s:81:"resources/ezcomponents/ConsoleTools/docs/img/consoletools_tutorial_example_08.png";s:4:"3be4";s:81:"resources/ezcomponents/ConsoleTools/docs/img/consoletools_tutorial_example_09.png";s:4:"37c3";s:81:"resources/ezcomponents/ConsoleTools/docs/img/consoletools_tutorial_example_10.png";s:4:"4375";s:60:"resources/ezcomponents/ConsoleTools/src/console_autoload.php";s:4:"4ae0";s:49:"resources/ezcomponents/ConsoleTools/src/input.php";s:4:"903b";s:50:"resources/ezcomponents/ConsoleTools/src/output.php";s:4:"2afb";s:55:"resources/ezcomponents/ConsoleTools/src/progressbar.php";s:4:"07c3";s:59:"resources/ezcomponents/ConsoleTools/src/progressmonitor.php";s:4:"5311";s:53:"resources/ezcomponents/ConsoleTools/src/statusbar.php";s:4:"2088";s:49:"resources/ezcomponents/ConsoleTools/src/table.php";s:4:"de32";s:64:"resources/ezcomponents/ConsoleTools/src/exceptions/exception.php";s:4:"0791";s:74:"resources/ezcomponents/ConsoleTools/src/exceptions/invalid_option_name.php";s:4:"0d7e";s:73:"resources/ezcomponents/ConsoleTools/src/exceptions/no_position_stored.php";s:4:"4a18";s:61:"resources/ezcomponents/ConsoleTools/src/exceptions/option.php";s:4:"a846";s:80:"resources/ezcomponents/ConsoleTools/src/exceptions/option_already_registered.php";s:4:"150a";s:81:"resources/ezcomponents/ConsoleTools/src/exceptions/option_arguments_violation.php";s:4:"fc9b";s:82:"resources/ezcomponents/ConsoleTools/src/exceptions/option_dependency_violation.php";s:4:"7cbd";s:81:"resources/ezcomponents/ConsoleTools/src/exceptions/option_exclusion_violation.php";s:4:"a7d6";s:81:"resources/ezcomponents/ConsoleTools/src/exceptions/option_mandatory_violation.php";s:4:"7f1f";s:75:"resources/ezcomponents/ConsoleTools/src/exceptions/option_missing_value.php";s:4:"9889";s:70:"resources/ezcomponents/ConsoleTools/src/exceptions/option_no_alias.php";s:4:"7f94";s:72:"resources/ezcomponents/ConsoleTools/src/exceptions/option_not_exists.php";s:4:"85ad";s:83:"resources/ezcomponents/ConsoleTools/src/exceptions/option_string_not_wellformed.php";s:4:"05c1";s:77:"resources/ezcomponents/ConsoleTools/src/exceptions/option_too_many_values.php";s:4:"90a2";s:76:"resources/ezcomponents/ConsoleTools/src/exceptions/option_type_violation.php";s:4:"77c3";s:56:"resources/ezcomponents/ConsoleTools/src/input/option.php";s:4:"de4d";s:58:"resources/ezcomponents/ConsoleTools/src/options/output.php";s:4:"c224";s:63:"resources/ezcomponents/ConsoleTools/src/options/progressbar.php";s:4:"fecd";s:67:"resources/ezcomponents/ConsoleTools/src/options/progressmonitor.php";s:4:"ac4f";s:61:"resources/ezcomponents/ConsoleTools/src/options/statusbar.php";s:4:"a4ee";s:57:"resources/ezcomponents/ConsoleTools/src/options/table.php";s:4:"4dc4";s:63:"resources/ezcomponents/ConsoleTools/src/structs/option_rule.php";s:4:"db5d";s:65:"resources/ezcomponents/ConsoleTools/src/structs/output_format.php";s:4:"73d3";s:66:"resources/ezcomponents/ConsoleTools/src/structs/output_formats.php";s:4:"b11d";s:54:"resources/ezcomponents/ConsoleTools/src/table/cell.php";s:4:"3225";s:53:"resources/ezcomponents/ConsoleTools/src/table/row.php";s:4:"1ef7";s:56:"resources/ezcomponents/ConsoleTools/tests/input_test.php";s:4:"5b40";s:62:"resources/ezcomponents/ConsoleTools/tests/option_rule_test.php";s:4:"1211";s:57:"resources/ezcomponents/ConsoleTools/tests/option_test.php";s:4:"f17f";s:64:"resources/ezcomponents/ConsoleTools/tests/output_format_test.php";s:4:"7fa9";s:65:"resources/ezcomponents/ConsoleTools/tests/output_formats_test.php";s:4:"aa04";s:65:"resources/ezcomponents/ConsoleTools/tests/output_options_test.php";s:4:"2a16";s:57:"resources/ezcomponents/ConsoleTools/tests/output_test.php";s:4:"ff39";s:70:"resources/ezcomponents/ConsoleTools/tests/progressbar_options_test.php";s:4:"7b73";s:62:"resources/ezcomponents/ConsoleTools/tests/progressbar_test.php";s:4:"dc66";s:74:"resources/ezcomponents/ConsoleTools/tests/progressmonitor_options_test.php";s:4:"97cf";s:66:"resources/ezcomponents/ConsoleTools/tests/progressmonitor_test.php";s:4:"218b";s:68:"resources/ezcomponents/ConsoleTools/tests/statusbar_options_test.php";s:4:"9b97";s:60:"resources/ezcomponents/ConsoleTools/tests/statusbar_test.php";s:4:"87ac";s:51:"resources/ezcomponents/ConsoleTools/tests/suite.php";s:4:"880b";s:61:"resources/ezcomponents/ConsoleTools/tests/table_cell_test.php";s:4:"b2b7";s:64:"resources/ezcomponents/ConsoleTools/tests/table_options_test.php";s:4:"fecf";s:60:"resources/ezcomponents/ConsoleTools/tests/table_row_test.php";s:4:"0534";s:56:"resources/ezcomponents/ConsoleTools/tests/table_test.php";s:4:"eea5";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress1.dat";s:4:"9165";s:65:"resources/ezcomponents/ConsoleTools/tests/data/testProgress10.dat";s:4:"5603";s:65:"resources/ezcomponents/ConsoleTools/tests/data/testProgress11.dat";s:4:"7127";s:65:"resources/ezcomponents/ConsoleTools/tests/data/testProgress12.dat";s:4:"461a";s:65:"resources/ezcomponents/ConsoleTools/tests/data/testProgress13.dat";s:4:"1255";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress2.dat";s:4:"f3d2";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress3.dat";s:4:"4668";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress4.dat";s:4:"b5d5";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress5.dat";s:4:"1bd7";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress6.dat";s:4:"8c5b";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress7.dat";s:4:"a4ea";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress8.dat";s:4:"7ad3";s:64:"resources/ezcomponents/ConsoleTools/tests/data/testProgress9.dat";s:4:"dd57";s:71:"resources/ezcomponents/ConsoleTools/tests/data/testProgressMonitor1.dat";s:4:"01d7";s:71:"resources/ezcomponents/ConsoleTools/tests/data/testProgressMonitor2.dat";s:4:"f23f";s:71:"resources/ezcomponents/ConsoleTools/tests/data/testProgressMonitor3.dat";s:4:"1757";s:71:"resources/ezcomponents/ConsoleTools/tests/data/testProgressMonitor4.dat";s:4:"fb52";s:65:"resources/ezcomponents/ConsoleTools/tests/data/testStatusbar1.dat";s:4:"11ef";s:65:"resources/ezcomponents/ConsoleTools/tests/data/testStatusbar2.dat";s:4:"7fc6";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable1a.dat";s:4:"8baa";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable1b.dat";s:4:"fb66";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable2a.dat";s:4:"e443";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable2b.dat";s:4:"1621";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable3a.dat";s:4:"79c3";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable3b.dat";s:4:"d73c";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable4a.dat";s:4:"7bb9";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable4b.dat";s:4:"36ac";s:62:"resources/ezcomponents/ConsoleTools/tests/data/testTable4c.dat";s:4:"7bb9";s:71:"resources/ezcomponents/ConsoleTools/tests/data/testTableColPadding1.dat";s:4:"fa54";s:71:"resources/ezcomponents/ConsoleTools/tests/data/testTableColPadding2.dat";s:4:"dac6";s:52:"resources/ezcomponents/autoload/archive_autoload.php";s:4:"f642";s:49:"resources/ezcomponents/autoload/base_autoload.php";s:4:"1e2a";s:50:"resources/ezcomponents/autoload/cache_autoload.php";s:4:"dfb0";s:58:"resources/ezcomponents/autoload/configuration_autoload.php";s:4:"72da";s:52:"resources/ezcomponents/autoload/console_autoload.php";s:4:"4ae0";s:47:"resources/ezcomponents/autoload/db_autoload.php";s:4:"078b";s:54:"resources/ezcomponents/autoload/db_schema_autoload.php";s:4:"03c5";s:50:"resources/ezcomponents/autoload/debug_autoload.php";s:4:"9f39";s:54:"resources/ezcomponents/autoload/execution_autoload.php";s:4:"478d";s:49:"resources/ezcomponents/autoload/file_autoload.php";s:4:"c067";s:59:"resources/ezcomponents/autoload/image_analyzer_autoload.php";s:4:"e19e";s:50:"resources/ezcomponents/autoload/image_autoload.php";s:4:"81c8";s:50:"resources/ezcomponents/autoload/input_autoload.php";s:4:"cc92";s:48:"resources/ezcomponents/autoload/log_autoload.php";s:4:"f8cb";s:57:"resources/ezcomponents/autoload/log_database_autoload.php";s:4:"bc4f";s:49:"resources/ezcomponents/autoload/mail_autoload.php";s:4:"64b2";s:55:"resources/ezcomponents/autoload/persistent_autoload.php";s:4:"952d";s:62:"resources/ezcomponents/autoload/persistent_object_autoload.php";s:4:"937f";s:58:"resources/ezcomponents/autoload/php_generator_autoload.php";s:4:"f41e";s:50:"resources/ezcomponents/autoload/query_autoload.php";s:4:"b931";s:51:"resources/ezcomponents/autoload/system_autoload.php";s:4:"976e";s:53:"resources/ezcomponents/autoload/template_autoload.php";s:4:"a82f";s:56:"resources/ezcomponents/autoload/translation_autoload.php";s:4:"d56e";s:62:"resources/ezcomponents/autoload/translation_cache_autoload.php";s:4:"4ed0";s:36:"tests/tx_ter_api_direct_testcase.php";s:4:"f6f7";s:32:"tests/tx_ter_helper_testcase.php";s:4:"0cd2";s:30:"tests/tx_ter_soap_testcase.php";s:4:"279f";s:52:"tests/fixtures/fixture_extuploaddataarray_zipped.dat";s:4:"e6c2";s:42:"tests/fixtures/special_characters_utf8.txt";s:4:"14cc";}', + 'constraints' => [ + 'depends' => [ + 'saltedpasswords' => '', + ], + 'conflicts' => [], + 'suggests' => [], + ], + 'suggests' => [], ]; - -?> \ No newline at end of file diff --git a/html/typo3conf/ext/ter/ext_localconf.php b/html/typo3conf/ext/ter/ext_localconf.php index 1fce3dd15be403e470a379d8731f2ab61ededac9..77ccd4d9a2606ead37be1395955c4e172944023c 100755 --- a/html/typo3conf/ext/ter/ext_localconf.php +++ b/html/typo3conf/ext/ter/ext_localconf.php @@ -1,14 +1,14 @@ $_EXTKEY, - 'title' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:tx_ter_updateCurrentVersionListTask.name', - 'description' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:tx_ter_updateCurrentVersionListTask.description', - 'additionalFields' => '', + 'extension' => $_EXTKEY, + 'title' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:tx_ter_updateCurrentVersionListTask.name', + 'description' => 'LLL:EXT:' . $_EXTKEY . '/locallang.xml:tx_ter_updateCurrentVersionListTask.description', + 'additionalFields' => '', ]; diff --git a/html/typo3conf/ext/ter/ext_tables.php b/html/typo3conf/ext/ter/ext_tables.php index e223d35a9915be4d84126cdd9814bacd7b3c2ace..41922ee76693939c47d1681e796587a29516ca21 100755 --- a/html/typo3conf/ext/ter/ext_tables.php +++ b/html/typo3conf/ext/ter/ext_tables.php @@ -1,6 +1,6 @@ \ No newline at end of file diff --git a/html/typo3conf/ext/ter/mod1/index.php b/html/typo3conf/ext/ter/mod1/index.php index f111a0c8009e3135cf6fcd16826d0f9926d32c6a..13133cd0667cd2ab7da298af727d8d7d9d81419d 100755 --- a/html/typo3conf/ext/ter/mod1/index.php +++ b/html/typo3conf/ext/ter/mod1/index.php @@ -29,7 +29,8 @@ require($BACK_PATH . 'template.php'); include('locallang.php'); $BE_USER->modAccess( - $MCONF, 1 + $MCONF, + 1 ); // This checks permissions and exits if the users has no permission for entry. class tx_ter_module1 extends \TYPO3\CMS\Backend\Module\BaseScriptClass @@ -78,7 +79,6 @@ class tx_ter_module1 extends \TYPO3\CMS\Backend\Module\BaseScriptClass $access = is_array($this->pageinfo) ? 1 : 0; if (($this->id && $access) || ($BE_USER->user['admin'] && !$this->id)) { - // Draw the header. $this->doc = GeneralUtility::makeInstance('mediumDoc'); $this->doc->backPath = $BACK_PATH; @@ -101,20 +101,28 @@ class tx_ter_module1 extends \TYPO3\CMS\Backend\Module\BaseScriptClass '; $headerSection = $this->doc->getHeader( - 'pages', $this->pageinfo, $this->pageinfo['_thePath'] - ) . '
' . $LANG->php3Lang['labels']['path'] . ': ' . GeneralUtility::fixed_lgd_cs( - $this->pageinfo['_thePath'], 50 - ); + 'pages', + $this->pageinfo, + $this->pageinfo['_thePath'] + ) . '
' . $LANG->php3Lang['labels']['path'] . ': ' . GeneralUtility::fixed_lgd_cs( + $this->pageinfo['_thePath'], + 50 + ); $this->content .= $this->doc->startPage($LANG->getLL('title')); $this->content .= $this->doc->header($LANG->getLL('title')); $this->content .= $this->doc->spacer(5); $this->content .= $this->doc->section( - "", $this->doc->funcMenu( - $headerSection, BackendUtility::getFuncMenu( - $this->id, 'SET[function]', $this->MOD_SETTINGS['function'], $this->MOD_MENU['function'] - ) - ) + "", + $this->doc->funcMenu( + $headerSection, + BackendUtility::getFuncMenu( + $this->id, + 'SET[function]', + $this->MOD_SETTINGS['function'], + $this->MOD_MENU['function'] + ) + ) ); $this->content .= $this->doc->divider(5); @@ -126,8 +134,9 @@ class tx_ter_module1 extends \TYPO3\CMS\Backend\Module\BaseScriptClass // ShortCut if ($BE_USER->mayMakeShortcut()) { $this->content .= $this->doc->spacer(20) . $this->doc->section( - '', $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']) - ); + '', + $this->doc->makeShortcutIcon('id', implode(',', array_keys($this->MOD_MENU)), $this->MCONF['name']) + ); } $this->content .= $this->doc->spacer(10); @@ -165,9 +174,7 @@ class tx_ter_module1 extends \TYPO3\CMS\Backend\Module\BaseScriptClass */ function moduleContent() { - } - } // Make instance: @@ -182,5 +189,3 @@ while (list(, $INC_FILE) = each($SOBE->include_once)) { $SOBE->main(); $SOBE->printContent(); - -?> \ No newline at end of file diff --git a/html/typo3conf/ext/ter/mod1/locallang.php b/html/typo3conf/ext/ter/mod1/locallang.php index f32735a110693785a94c2114db3a9a7ddea514a1..2c99c360b9b763d6b19b599cab1f2f3c2597dace 100755 --- a/html/typo3conf/ext/ter/mod1/locallang.php +++ b/html/typo3conf/ext/ter/mod1/locallang.php @@ -41,4 +41,3 @@ $LOCAL_LANG = [ 'ru' => [], 'ro' => [], ]; -?> \ No newline at end of file diff --git a/html/typo3conf/ext/ter/mod1/locallang_mod.php b/html/typo3conf/ext/ter/mod1/locallang_mod.php index 75c5412c3f06e7fa2063bd55a18a5a36a915eef0..e5af0498e11ef38c96b38ae459dd856faaeef6e0 100755 --- a/html/typo3conf/ext/ter/mod1/locallang_mod.php +++ b/html/typo3conf/ext/ter/mod1/locallang_mod.php @@ -40,5 +40,3 @@ $LOCAL_LANG = [ 'ru' => [], 'ro' => [], ]; - -?> \ No newline at end of file diff --git a/html/typo3conf/ext/ter/pi1/locallang.php b/html/typo3conf/ext/ter/pi1/locallang.php index de5ef4a0f3754e294d7ed5238552378733baa228..096b62d9037187e3bce282356b6f47e2804d40af 100755 --- a/html/typo3conf/ext/ter/pi1/locallang.php +++ b/html/typo3conf/ext/ter/pi1/locallang.php @@ -36,4 +36,3 @@ $LOCAL_LANG = [ 'ru' => [], 'ro' => [], ]; -?> \ No newline at end of file diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/docs/repos/Me/myclass1.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/docs/repos/Me/myclass1.php index 79584b542b2c20d4b1381df7b53bbdcf6e0c084b..1db42d2029e4e0349d47dd72e82824746a917ec8 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/docs/repos/Me/myclass1.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/docs/repos/Me/myclass1.php @@ -1,9 +1,8 @@ - \ No newline at end of file + \ No newline at end of file + \ No newline at end of file + \ No newline at end of file + 'Me/myclass1.php', - 'erMyClass2' => 'Me/myclass2.php', - ); -?> + 'Me/myclass1.php', + 'erMyClass2' => 'Me/myclass2.php', + ); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/docs/repos/autoloads/your_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/docs/repos/autoloads/your_autoload.php index 588b4006da3730182f16b61f0c05b4be7e98d221..097585e9d87cb2810c161b61d134fcc53ad7031a 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/docs/repos/autoloads/your_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/docs/repos/autoloads/your_autoload.php @@ -1,6 +1,5 @@ - 'You/yourclass1.php', - 'erYourClass2' => 'You/yourclass2.php', - ); -?> + 'You/yourclass1.php', + 'erYourClass2' => 'You/yourclass2.php', + ); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/docs/tutorial_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/docs/tutorial_autoload.php index 0dc0a532afe76573adec396b64ebf21c0daa99a5..2ca6ec01488e7ca15f0314e2fbd2f8de577ba61b 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/docs/tutorial_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/docs/tutorial_autoload.php @@ -1,20 +1,24 @@ - +toString(); -$yourVar1 = new erYourClass1(); -$yourVar1->toString(); -?> +toString(); +$yourVar1 = new erYourClass1(); +$yourVar1->toString(); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/base.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/base.php index 86943ccac80f0d17f8068f2fc702cbe194a7ce6f..174ad08e41b6c9dbe973ba9f91ad4bf915cceaad 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/base.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/base.php @@ -1,452 +1,416 @@ -array) Stores info with additional paths where - * autoload files and classes for autoloading - * could be found. Each item of $repositoryDirs - * looks like array( autoloadFileDir, baseDir ). - */ - protected static $repositoryDirs = array(); - - /** - * @var array This variable stores all the elements from the autoload - * arrays. When a new autoload file is loaded, their files - * are added to this array. - */ - protected static $autoloadArray = array(); - - /** - * @var array This variable stores all the elements from the autoload - * arrays for external repositories. When a new autoload file - * is loaded, their files are added to this array. - */ - protected static $externalAutoloadArray = array(); - - /** - * Tries to autoload the given className. If the className could be found - * this method returns true, otherwise false. - * - * This class caches the requested class names (including the ones who - * failed to load). - * - * - * @param string $className The name of the class that should be loaded. - * - * @return bool - */ - public static function autoload( $className ) - { - ezcBase::setPackageDir(); - - // Check whether the classname is already in the cached autoloadArray. - if ( array_key_exists( $className, ezcBase::$autoloadArray ) ) - { - // Is it registered as 'unloadable'? - if ( ezcBase::$autoloadArray[$className] == false ) - { - return false; - } - ezcBase::loadFile( ezcBase::$autoloadArray[$className] ); - - return true; - } - - // Check whether the classname is already in the cached autoloadArray - // for external repositories.. - if ( array_key_exists( $className, ezcBase::$externalAutoloadArray ) ) - { - // Is it registered as 'unloadable'? - if ( ezcBase::$externalAutoloadArray[$className] == false ) - { - return false; - } - ezcBase::loadExternalFile( ezcBase::$externalAutoloadArray[$className] ); - - return true; - } - - // Not cached, so load the autoload from the package. - // Matches the first and optionally the second 'word' from the classname. - if ( preg_match( "/^[a-z]*([A-Z][a-z]*)([A-Z][a-z]*)?/", $className, $matches ) !== false ) - { - $autoloadFile = ""; - // Try to match with both names, if available. - switch ( sizeof( $matches ) ) - { - case 3: - $autoloadFile = strtolower( "{$matches[1]}_{$matches[2]}_autoload.php" ); - if ( ezcBase::requireFile( $autoloadFile, $className ) ) - { - return true; - } - // break intentionally missing. - - case 2: - $autoloadFile = strtolower( "{$matches[1]}_autoload.php" ); - if ( ezcBase::requireFile( $autoloadFile, $className ) ) - { - return true; - } - break; - } - - // Maybe there is another autoload available. - // Register this classname as false. - ezcBase::$autoloadArray[$className] = false; - } - - $path = ezcBase::$packageDir . 'autoload/'; - $realPath = realpath( $path ); - if ( $realPath == '' ) - { - trigger_error( "Couldn't find autoload directory '$path'", E_USER_ERROR ); - } - /* FIXME: this should go away - only for development */ - if ( self::libraryMode == 'devel' ) - { - trigger_error( "Couldn't find autoload file for '$className' in '$realPath'", E_USER_WARNING ); - } - return false; - } - - /** - * Returns the path to the autoload directory. The path depends on - * the installation of the ezComponents. The SVN version has different - * paths than the PEAR installed version. (For now). - * - * @return string - */ - protected static function setPackageDir() - { - // Get the path to the components. - $baseDir = dirname( __FILE__ ); - - switch ( ezcBase::libraryMode ) - { - case "devel": - case "tarball": - ezcBase::$packageDir = $baseDir. "/../../"; - break; - case "pear"; - ezcBase::$packageDir = $baseDir. "/../"; - break; - } - } - - /** - * Tries to load the autoload array and, if loaded correctly, includes the class. - * - * @param string $fileName Name of the autoload file. - * @param string $className Name of the class that should be autoloaded. - * - * @return bool True is returned when the file is correctly loaded. - * Otherwise false is returned. - */ - protected static function requireFile( $fileName, $className ) - { - $autoloadDir = ezcBase::$packageDir . "autoload/"; - - // We need the full path to the fileName. The method file_exists() doesn't - // automatically check the (php.ini) library paths. Therefore: - // file_exists( "ezc/autoload/$fileName" ) doesn't work. - if ( file_exists( "$autoloadDir$fileName" ) ) - { - $array = require( "$autoloadDir$fileName" ); - - if ( is_array( $array) && array_key_exists( $className, $array ) ) - { - // Add the array to the cache, and include the requested file. - ezcBase::$autoloadArray = array_merge( ezcBase::$autoloadArray, $array ); - ezcBase::loadFile( ezcBase::$autoloadArray[$className] ); - return true; - } - } - - // It is not in components autoload/ dir. - // try to search in additional dirs. - foreach ( ezcBase::$repositoryDirs as $extraDir ) - { - if ( file_exists( $extraDir['autoloadDirPath'] . '/' . $fileName ) ) - { - $originalArray = require( $extraDir['autoloadDirPath'] . '/' . $fileName ); - - // Building paths. - // Resulting path to class definition file consists of: - // path to extra directory with autoload file + - // basePath provided for current extra directory + - // path to class definition file stored in autoload file. - foreach ( $originalArray as $class => $classPath ) - { - $array[$class] = $extraDir['basePath'] . '/' . $classPath; - } - - if ( is_array( $array ) && array_key_exists( $className, $array ) ) - { - // Add the array to the cache, and include the requested file. - ezcBase::$externalAutoloadArray = array_merge( ezcBase::$externalAutoloadArray, $array ); - ezcBase::loadExternalFile( ezcBase::$externalAutoloadArray[$className] ); - return true; - } - } - } - - //Nothing found :-(. - return false; - } - - /** - * Loads, require(), the given file name. If we are in development mode, - * "/src/" is inserted into the path. - * - * @param string $file The name of the file that should be loaded. - */ - protected static function loadFile( $file ) - { - $originalFile = $file; - list( $first, $second ) = explode( '/', $file, 2 ); - switch ( ezcBase::libraryMode ) - { - case "devel": - case "tarball": - // Add the "src/" after the package name. - $file = $first . "/src/" . $second; - break; - - case "pear": - $file = $first . '/'. $second; - break; - } - - if ( file_exists( ezcBase::$packageDir . $file ) ) - { - require( ezcBase::$packageDir . $file ); - } - else - { - throw new ezcBaseFileNotFoundException( ezcBase::$packageDir.$file ); - } - } - - /** - * Loads, require(), the given file name from an external package. - * - * @param string $file The name of the file that should be loaded. - */ - protected static function loadExternalFile( $file ) - { - if ( file_exists( $file ) ) - { - require( $file ); - } - else - { - throw new ezcBaseFileNotFoundException( $file ); - } - } - - /** - * Checks for dependencies on PHP versions or extensions - * - * The function as called by the $component component checks for the $type - * dependency. The dependency $type is compared against the $value. The - * function aborts the script if the dependency is not matched. - * - * @param string $component - * @param int $type - * @param mixed $value - */ - public static function checkDependency( $component, $type, $value ) - { - switch ( $type ) - { - case self::DEP_PHP_EXTENSION: - if ( extension_loaded( $value ) ) - { - return; - } - else - { - die( "\nThe {$component} component depends on the PHP extension '{$value}', which is not loaded.\n" ); - } - break; - - case self::DEP_PHP_VERSION: - $phpVersion = phpversion(); - if ( version_compare( $phpVersion, $value, '>=' ) ) - { - return; - } - else - { - die( "\nThe {$component} component depends on the PHP version '{$value}', but the current version is '{$phpVersion}'.\n" ); - } - break; - } - } - - /** - * Return the list of directories that contain class repositories. - * - * The path to the eZ components directory is always included in the result - * array. Each element in the returned array has the format of: - * packageDirectory => array( $type, autoloadDirectory ) - * The $type is either "ezc" for the eZ components directory or "external" - * for external repositories. - * - * @return array(string=>array) - * @access private - */ - public static function getRepositoryDirectories() - { - $autoloadDirs = array(); - ezcBase::setPackageDir(); - $repositoryDir = realpath( dirname( __FILE__ ) . '/../../' ); - $autoloadDirs[$repositoryDir] = array( 'ezc', $repositoryDir . "/autoload" ); - - foreach ( ezcBase::$repositoryDirs as $extraDirKey => $extraDirArray ) - { - $autoloadDirs[$extraDirKey] = array( 'external', $extraDirArray['autoloadDirPath'] ); - } - - return $autoloadDirs; - } - - /** - * Adds an additional class repository. - * - * Used for adding class repositoryies outside the eZ components to be - * loaded by the autoload system. - * - * This function takes two arguments: $basePath is the base path for the - * whole class repository and $autoloadDirPath the path where autoload - * files for this repository are found. The paths in the autoload files are - * relative to the package directory as specified by the $basePath - * argument. I.e. class definition file will be searched at location - * $basePath + path to the class definition file as stored in the autoload - * file. - * - * addClassRepository() should be called somewhere in code before external classes - * are used. - * - * Example: - * Take the following facts: - * - * - * In this case you would need to create the following files in - * "./repos/autoloads". Please note that the part before _autoload.php in - * the filename is the first part of the classname, not considering - * the all lower-case letter prefix. - * - * "my_autoload.php": - * - * 'Me/myclass1.php', - * 'erMyClass2' => 'Me/myclass2.php', - * ); - * ?> - * - * - * "your_autoload.php": - * - * 'You/yourclass1.php', - * 'erYourClass2' => 'You/yourclass2.php', - * ); - * ?> - * - * - * The directory structure for the external repository is then: - * - * ./repos/autoloads/my_autoload.php - * ./repos/autoloads/you_autoload.php - * ./repos/Me/myclass1.php - * ./repos/Me/myclass2.php - * ./repos/You/yourclass1.php - * ./repos/You/yourclass2.php - * - - * To use this repository with the autoload mechanism you have to use the - * following code: - * - * - * - * - * @throws ezcBaseFileNotFoundException if $autoloadDirPath or $basePath do not exist. - * @param string $autoloadDirPath - * @param string $basePath - */ - public static function addClassRepository( $basePath, $autoloadDirPath = null ) - { - // check if base path exists - if ( !is_dir( $basePath ) ) - { - throw new ezcBaseFileNotFoundException( $basePath, 'base directory' ); - } - - // calculate autoload path if it wasn't given - if ( is_null( $autoloadDirPath ) ) - { - $autoloadDirPath = $basePath . '/autoload'; - } - - // check if autoload dir exists - if ( !is_dir( $autoloadDirPath ) ) - { - throw new ezcBaseFileNotFoundException( $autoloadDirPath, 'autoload directory' ); - } - - // add info to $repositoryDirs - // $autoloadDirPath will be used as a key in $repositoryDirs - $array = array( $basePath => array( 'basePath' => $basePath, 'autoloadDirPath' => $autoloadDirPath ) ); - - // add info to the list of extra dirs if it exists there it will not be doubled. - ezcBase::$repositoryDirs = array_merge( ezcBase::$repositoryDirs, $array ); - } -} -?> +array) Stores info with additional paths where + * autoload files and classes for autoloading + * could be found. Each item of $repositoryDirs + * looks like array( autoloadFileDir, baseDir ). + */ + protected static $repositoryDirs = array(); + + /** + * @var array This variable stores all the elements from the autoload + * arrays. When a new autoload file is loaded, their files + * are added to this array. + */ + protected static $autoloadArray = array(); + + /** + * @var array This variable stores all the elements from the autoload + * arrays for external repositories. When a new autoload file + * is loaded, their files are added to this array. + */ + protected static $externalAutoloadArray = array(); + + /** + * Tries to autoload the given className. If the className could be found + * this method returns true, otherwise false. + * + * This class caches the requested class names (including the ones who + * failed to load). + * + * + * @param string $className The name of the class that should be loaded. + * + * @return bool + */ + public static function autoload($className) + { + ezcBase::setPackageDir(); + + // Check whether the classname is already in the cached autoloadArray. + if (array_key_exists($className, ezcBase::$autoloadArray)) { + // Is it registered as 'unloadable'? + if (ezcBase::$autoloadArray[$className] == false) { + return false; + } + ezcBase::loadFile(ezcBase::$autoloadArray[$className]); + + return true; + } + + // Check whether the classname is already in the cached autoloadArray + // for external repositories.. + if (array_key_exists($className, ezcBase::$externalAutoloadArray)) { + // Is it registered as 'unloadable'? + if (ezcBase::$externalAutoloadArray[$className] == false) { + return false; + } + ezcBase::loadExternalFile(ezcBase::$externalAutoloadArray[$className]); + + return true; + } + + // Not cached, so load the autoload from the package. + // Matches the first and optionally the second 'word' from the classname. + if (preg_match("/^[a-z]*([A-Z][a-z]*)([A-Z][a-z]*)?/", $className, $matches) !== false) { + $autoloadFile = ""; + // Try to match with both names, if available. + switch (sizeof($matches)) { + case 3: + $autoloadFile = strtolower("{$matches[1]}_{$matches[2]}_autoload.php"); + if (ezcBase::requireFile($autoloadFile, $className)) { + return true; + } + // break intentionally missing. + + case 2: + $autoloadFile = strtolower("{$matches[1]}_autoload.php"); + if (ezcBase::requireFile($autoloadFile, $className)) { + return true; + } + break; + } + + // Maybe there is another autoload available. + // Register this classname as false. + ezcBase::$autoloadArray[$className] = false; + } + + $path = ezcBase::$packageDir . 'autoload/'; + $realPath = realpath($path); + if ($realPath == '') { + trigger_error("Couldn't find autoload directory '$path'", E_USER_ERROR); + } + /* FIXME: this should go away - only for development */ + if (self::libraryMode == 'devel') { + trigger_error("Couldn't find autoload file for '$className' in '$realPath'", E_USER_WARNING); + } + return false; + } + + /** + * Returns the path to the autoload directory. The path depends on + * the installation of the ezComponents. The SVN version has different + * paths than the PEAR installed version. (For now). + * + * @return string + */ + protected static function setPackageDir() + { + // Get the path to the components. + $baseDir = dirname(__FILE__); + + switch (ezcBase::libraryMode) { + case "devel": + case "tarball": + ezcBase::$packageDir = $baseDir. "/../../"; + break; + case "pear"; + ezcBase::$packageDir = $baseDir. "/../"; + break; + } + } + + /** + * Tries to load the autoload array and, if loaded correctly, includes the class. + * + * @param string $fileName Name of the autoload file. + * @param string $className Name of the class that should be autoloaded. + * + * @return bool True is returned when the file is correctly loaded. + * Otherwise false is returned. + */ + protected static function requireFile($fileName, $className) + { + $autoloadDir = ezcBase::$packageDir . "autoload/"; + + // We need the full path to the fileName. The method file_exists() doesn't + // automatically check the (php.ini) library paths. Therefore: + // file_exists( "ezc/autoload/$fileName" ) doesn't work. + if (file_exists("$autoloadDir$fileName")) { + $array = require("$autoloadDir$fileName"); + + if (is_array($array) && array_key_exists($className, $array)) { + // Add the array to the cache, and include the requested file. + ezcBase::$autoloadArray = array_merge(ezcBase::$autoloadArray, $array); + ezcBase::loadFile(ezcBase::$autoloadArray[$className]); + return true; + } + } + + // It is not in components autoload/ dir. + // try to search in additional dirs. + foreach (ezcBase::$repositoryDirs as $extraDir) { + if (file_exists($extraDir['autoloadDirPath'] . '/' . $fileName)) { + $originalArray = require($extraDir['autoloadDirPath'] . '/' . $fileName); + + // Building paths. + // Resulting path to class definition file consists of: + // path to extra directory with autoload file + + // basePath provided for current extra directory + + // path to class definition file stored in autoload file. + foreach ($originalArray as $class => $classPath) { + $array[$class] = $extraDir['basePath'] . '/' . $classPath; + } + + if (is_array($array) && array_key_exists($className, $array)) { + // Add the array to the cache, and include the requested file. + ezcBase::$externalAutoloadArray = array_merge(ezcBase::$externalAutoloadArray, $array); + ezcBase::loadExternalFile(ezcBase::$externalAutoloadArray[$className]); + return true; + } + } + } + + //Nothing found :-(. + return false; + } + + /** + * Loads, require(), the given file name. If we are in development mode, + * "/src/" is inserted into the path. + * + * @param string $file The name of the file that should be loaded. + */ + protected static function loadFile($file) + { + $originalFile = $file; + list( $first, $second ) = explode('/', $file, 2); + switch (ezcBase::libraryMode) { + case "devel": + case "tarball": + // Add the "src/" after the package name. + $file = $first . "/src/" . $second; + break; + + case "pear": + $file = $first . '/'. $second; + break; + } + + if (file_exists(ezcBase::$packageDir . $file)) { + require(ezcBase::$packageDir . $file); + } else { + throw new ezcBaseFileNotFoundException(ezcBase::$packageDir.$file); + } + } + + /** + * Loads, require(), the given file name from an external package. + * + * @param string $file The name of the file that should be loaded. + */ + protected static function loadExternalFile($file) + { + if (file_exists($file)) { + require($file); + } else { + throw new ezcBaseFileNotFoundException($file); + } + } + + /** + * Checks for dependencies on PHP versions or extensions + * + * The function as called by the $component component checks for the $type + * dependency. The dependency $type is compared against the $value. The + * function aborts the script if the dependency is not matched. + * + * @param string $component + * @param int $type + * @param mixed $value + */ + public static function checkDependency($component, $type, $value) + { + switch ($type) { + case self::DEP_PHP_EXTENSION: + if (extension_loaded($value)) { + return; + } else { + die("\nThe {$component} component depends on the PHP extension '{$value}', which is not loaded.\n"); + } + break; + + case self::DEP_PHP_VERSION: + $phpVersion = phpversion(); + if (version_compare($phpVersion, $value, '>=')) { + return; + } else { + die("\nThe {$component} component depends on the PHP version '{$value}', but the current version is '{$phpVersion}'.\n"); + } + break; + } + } + + /** + * Return the list of directories that contain class repositories. + * + * The path to the eZ components directory is always included in the result + * array. Each element in the returned array has the format of: + * packageDirectory => array( $type, autoloadDirectory ) + * The $type is either "ezc" for the eZ components directory or "external" + * for external repositories. + * + * @return array(string=>array) + * @access private + */ + public static function getRepositoryDirectories() + { + $autoloadDirs = array(); + ezcBase::setPackageDir(); + $repositoryDir = realpath(dirname(__FILE__) . '/../../'); + $autoloadDirs[$repositoryDir] = array( 'ezc', $repositoryDir . "/autoload" ); + + foreach (ezcBase::$repositoryDirs as $extraDirKey => $extraDirArray) { + $autoloadDirs[$extraDirKey] = array( 'external', $extraDirArray['autoloadDirPath'] ); + } + + return $autoloadDirs; + } + + /** + * Adds an additional class repository. + * + * Used for adding class repositoryies outside the eZ components to be + * loaded by the autoload system. + * + * This function takes two arguments: $basePath is the base path for the + * whole class repository and $autoloadDirPath the path where autoload + * files for this repository are found. The paths in the autoload files are + * relative to the package directory as specified by the $basePath + * argument. I.e. class definition file will be searched at location + * $basePath + path to the class definition file as stored in the autoload + * file. + * + * addClassRepository() should be called somewhere in code before external classes + * are used. + * + * Example: + * Take the following facts: + * + * + * In this case you would need to create the following files in + * "./repos/autoloads". Please note that the part before _autoload.php in + * the filename is the first part of the classname, not considering + * the all lower-case letter prefix. + * + * "my_autoload.php": + * + * 'Me/myclass1.php', + * 'erMyClass2' => 'Me/myclass2.php', + * ); + * ?> + * + * + * "your_autoload.php": + * + * 'You/yourclass1.php', + * 'erYourClass2' => 'You/yourclass2.php', + * ); + * ?> + * + * + * The directory structure for the external repository is then: + * + * ./repos/autoloads/my_autoload.php + * ./repos/autoloads/you_autoload.php + * ./repos/Me/myclass1.php + * ./repos/Me/myclass2.php + * ./repos/You/yourclass1.php + * ./repos/You/yourclass2.php + * + + * To use this repository with the autoload mechanism you have to use the + * following code: + * + * + * + * + * @throws ezcBaseFileNotFoundException if $autoloadDirPath or $basePath do not exist. + * @param string $autoloadDirPath + * @param string $basePath + */ + public static function addClassRepository($basePath, $autoloadDirPath = null) + { + // check if base path exists + if (!is_dir($basePath)) { + throw new ezcBaseFileNotFoundException($basePath, 'base directory'); + } + + // calculate autoload path if it wasn't given + if (is_null($autoloadDirPath)) { + $autoloadDirPath = $basePath . '/autoload'; + } + + // check if autoload dir exists + if (!is_dir($autoloadDirPath)) { + throw new ezcBaseFileNotFoundException($autoloadDirPath, 'autoload directory'); + } + + // add info to $repositoryDirs + // $autoloadDirPath will be used as a key in $repositoryDirs + $array = array( $basePath => array( 'basePath' => $basePath, 'autoloadDirPath' => $autoloadDirPath ) ); + + // add info to the list of extra dirs if it exists there it will not be doubled. + ezcBase::$repositoryDirs = array_merge(ezcBase::$repositoryDirs, $array); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/base_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/base_autoload.php index 2dafd506d30efb639410f0999989049f1252ff3e..49b809741f6db275ddea79d5c5a0d84399dd4560 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/base_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/base_autoload.php @@ -1,26 +1,25 @@ - 'Base/exceptions/exception.php', - 'ezcBaseFileException' => 'Base/exceptions/file_exception.php', - - 'ezcBaseFileNotFoundException' => 'Base/exceptions/file_not_found.php', - 'ezcBaseFileIoException' => 'Base/exceptions/file_io.php', - 'ezcBaseFilePermissionException' => 'Base/exceptions/file_permission.php', - 'ezcBasePropertyPermissionException' => 'Base/exceptions/property_permission.php', - 'ezcBasePropertyNotFoundException' => 'Base/exceptions/property_not_found.php', - 'ezcBaseSettingNotFoundException' => 'Base/exceptions/setting_not_found.php', - 'ezcBaseSettingValueException' => 'Base/exceptions/setting_value.php', - 'ezcBaseValueException' => 'Base/exceptions/value.php', - - 'ezcBaseOptions' => 'Base/options.php', - 'ezcBaseStruct' => 'Base/struct.php', -); -?> + 'Base/exceptions/exception.php', + 'ezcBaseFileException' => 'Base/exceptions/file_exception.php', + + 'ezcBaseFileNotFoundException' => 'Base/exceptions/file_not_found.php', + 'ezcBaseFileIoException' => 'Base/exceptions/file_io.php', + 'ezcBaseFilePermissionException' => 'Base/exceptions/file_permission.php', + 'ezcBasePropertyPermissionException' => 'Base/exceptions/property_permission.php', + 'ezcBasePropertyNotFoundException' => 'Base/exceptions/property_not_found.php', + 'ezcBaseSettingNotFoundException' => 'Base/exceptions/setting_not_found.php', + 'ezcBaseSettingValueException' => 'Base/exceptions/setting_value.php', + 'ezcBaseValueException' => 'Base/exceptions/value.php', + + 'ezcBaseOptions' => 'Base/options.php', + 'ezcBaseStruct' => 'Base/struct.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/exception.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/exception.php index f4e8e2cf50ee50b90abd00bde11108ba71712604..0072da9bd764bd67e6e11e1d6ae93e1f2aca9c5a 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/exception.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/exception.php @@ -1,43 +1,39 @@ -originalMessage = $message; - - if ( php_sapi_name() == 'cli' ) - { - parent::__construct( $message ); - } - else - { - parent::__construct( htmlspecialchars( $message ) ); - } - } -} -?> +originalMessage = $message; + + if (php_sapi_name() == 'cli') { + parent::__construct($message); + } else { + parent::__construct(htmlspecialchars($message)); + } + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/file_exception.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/file_exception.php index ed8c1f2b3d97905f05c503465eae07b8652c0e4c..5348126a573764ebee99e48c985037659c2e3bf2 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/file_exception.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/file_exception.php @@ -1,25 +1,24 @@ - +"; - break; - case ezcBaseFileException::WRITE: - $operation = "An error occurred while writing to <{$path}>"; - break; - } - - $messagePart = ''; - if ( $message ) - { - $messagePart = " ($message)"; - } - - parent::__construct( "$operation.$messagePart" ); - } -} -?> +"; + break; + case ezcBaseFileException::WRITE: + $operation = "An error occurred while writing to <{$path}>"; + break; + } + + $messagePart = ''; + if ($message) { + $messagePart = " ($message)"; + } + + parent::__construct("$operation.$messagePart"); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/file_not_found.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/file_not_found.php index 307dd3706f9e400ed593059b1723de55b86458f9..53cd978a5d2e5f20bff2c61dcb07e73be39c13df 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/file_not_found.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/file_not_found.php @@ -1,43 +1,40 @@ - could not be found.$messagePart" ); - } -} -?> + could not be found.$messagePart"); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/file_permission.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/file_permission.php index 0eb9d055183a598ebe54667299dceeb070211fd8..b77ec39321a5264d9eac2865944a37349c806c22 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/file_permission.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/file_permission.php @@ -1,63 +1,60 @@ - can not be opened for reading"; - break; - case ezcBaseFileException::WRITE: - $operation = "The file <{$path}> can not be opened for writing"; - break; - case ezcBaseFileException::EXECUTE: - $operation = "The file <{$path}> can not be executed"; - break; - case ezcBaseFileException::CHANGE: - $operation = "The permissions for <{$path}> can not be changed"; - break; - case ezcBaseFileException::REMOVE: - $operation = "The file <{$path}> can not be removed"; - break; - case ( ezcBaseFileException::READ || ezcBaseFileException::WRITE ): - $operation = "The file <{$path}> can not be opened for reading and writing"; - break; - } - - $messagePart = ''; - if ( $message ) - { - $messagePart = " ($message)"; - } - - parent::__construct( "$operation.$messagePart" ); - } -} -?> + can not be opened for reading"; + break; + case ezcBaseFileException::WRITE: + $operation = "The file <{$path}> can not be opened for writing"; + break; + case ezcBaseFileException::EXECUTE: + $operation = "The file <{$path}> can not be executed"; + break; + case ezcBaseFileException::CHANGE: + $operation = "The permissions for <{$path}> can not be changed"; + break; + case ezcBaseFileException::REMOVE: + $operation = "The file <{$path}> can not be removed"; + break; + case ( ezcBaseFileException::READ || ezcBaseFileException::WRITE ): + $operation = "The file <{$path}> can not be opened for reading and writing"; + break; + } + + $messagePart = ''; + if ($message) { + $messagePart = " ($message)"; + } + + parent::__construct("$operation.$messagePart"); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/property_not_found.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/property_not_found.php index fb36ca71f9d5717c6b6447e7e4a4badb4fef0fc0..8584dd3aee80233ff0e057b102421796089b0deb 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/property_not_found.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/property_not_found.php @@ -1,28 +1,27 @@ -." ); - } -} -?> +."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/property_permission.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/property_permission.php index 3ee36880a007c17c72f0266511680614d8b744cd..3761fa38437668dab5bbe39e3ff4a9d6a00fddaf 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/property_permission.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/property_permission.php @@ -1,42 +1,41 @@ - is " . - ( $mode == self::READ ? "read" : "write" ) . - "-only." ); - } -} -?> + is " . + ( $mode == self::READ ? "read" : "write" ) . + "-only."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/setting_not_found.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/setting_not_found.php index ad11c714238ab34a612de7310466beaa6b406043..6d74d9c89625abb5154c7c3491589a8f13141eb2 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/setting_not_found.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/setting_not_found.php @@ -1,28 +1,27 @@ - is not a valid configuration setting." ); - } -} -?> + is not a valid configuration setting."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/setting_value.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/setting_value.php index 1bccbccf89d8a2262c5892b409e7e2878d5666a7..e38a65055466546a8715ef5a62fda804e953d0b7 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/setting_value.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/setting_value.php @@ -1,41 +1,38 @@ - that you were trying to assign to setting <{$settingName}> is invalid."; - if ( $expectedValue ) - { - $msg .= " Allowed values are: " . $expectedValue; - } - parent::__construct( $msg ); - } -} -?> + that you were trying to assign to setting <{$settingName}> is invalid."; + if ($expectedValue) { + $msg .= " Allowed values are: " . $expectedValue; + } + parent::__construct($msg); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/value.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/value.php index 9c47fb1dc047aea5c8bae7071bdcd9f6045ad1a4..410e7a301d94f5835bbc5c54a31d5968d01d4cf4 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/value.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/value.php @@ -1,42 +1,39 @@ - that you were trying to assign to setting <{$settingName}> is invalid."; - if ( $expectedValue ) - { - $msg .= " Allowed values are: " . $expectedValue . '.'; - } - parent::__construct( $msg ); - } -} -?> + that you were trying to assign to setting <{$settingName}> is invalid."; + if ($expectedValue) { + $msg .= " Allowed values are: " . $expectedValue . '.'; + } + parent::__construct($msg); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/whatever.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/whatever.php index 7a65f04569e69964a28459001eb5d858edb9b0f4..c941e982c176fca311dcfa883df9227413f3e947 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/whatever.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/exceptions/whatever.php @@ -1,40 +1,39 @@ - +mixed) - */ - protected $properties; - - /** - * Sets an option. - * This method is called when an option is set. - * - * @param string $key The option name. - * @param mixed $value The option value. - * @ignore void - */ - abstract public function __set( $propertyName, $propertyValue ); - - /** - * Construct a new options object. - * Options are constructed from an option array by default. The constructor - * automatically passes the given options to the __set() method to set them - * in the class. - * - * @param array(string=>mixed) $options The initial options to set. - * @return void - * - * @throws ezcBasePropertyNotFoundException - * If a the value for the property options is not an instance of - * @throws ezcBaseValueException - * If a the value for a property is out of range. - */ - public function __construct( array $options = array() ) - { - foreach ( $options as $option => $value ) - { - $this->__set( $option, $value ); - } - } - - /** - * Merge an array into the actual options object. - * This method merges an array of new options into the actual options object. - * - * @param array $newOptions The new options. - * @return void - * - * @throws ezcBasePropertyNotFoundException - * If a the value for the property options is not an instance of - * @throws ezcBaseValueException - * If a the value for a property is out of range. - */ - public function merge( array $newOptions ) - { - foreach ( $newOptions as $key => $value ) - { - $this->__set( $key, $value ); - } - } - - /** - * Property get access. - * Simply returns a given option. - * - * @param string $propertyName The name of the option to get. - * @return mixed The option value. - * - * @throws ezcBasePropertyNotFoundException - * If a the value for the property options is not an instance of - */ - public function __get( $propertyName ) - { - if ( isset( $this->properties[$propertyName] ) ) - { - return $this->properties[$propertyName]; - } - throw new ezcBasePropertyNotFoundException( $propertyName ); - } - - /** - * Returns if an option exists. - * Allows isset() using ArrayAccess. - * - * @param string $propertyName The name of the option to get. - * @return bool Wether the option exists. - */ - public function offsetExists( $propertyName ) - { - return isset( $this->properties[$propertyName] ); - } - - /** - * Returns an option value. - * Get an option value by ArrayAccess. - * - * @param string $propertyName The name of the option to get. - * @return mixed The option value. - * - * @throws ezcBasePropertyNotFoundException - * If a the value for the property options is not an instance of - */ - public function offsetGet( $propertyName ) - { - return $this->__get( $propertyName ); - } - - /** - * Set an option. - * Sets an option using ArrayAccess. - * - * @param string $propertyName The option to set. - * @param mixed $propertyValue The value for the option. - * @return void - * - * @throws ezcBasePropertyNotFoundException - * If a the value for the property options is not an instance of - * @throws ezcBaseValueException - * If a the value for a property is out of range. - */ - public function offsetSet( $propertyName, $propertyValue ) - { - $this->__set( $propertyName, $propertyValue ); - } - - /** - * Unset an option. - * Unsets an option using ArrayAccess. - * - * @param string $propertyName The options to unset. - * @return void - * - * @throws ezcBasePropertyNotFoundException - * If a the value for the property options is not an instance of - * @throws ezcBaseValueException - * If a the value for a property is out of range. - */ - public function offsetUnset( $propertyName ) - { - $this->__set( $propertyName, null ); - } -} -?> +mixed) + */ + protected $properties; + + /** + * Sets an option. + * This method is called when an option is set. + * + * @param string $key The option name. + * @param mixed $value The option value. + * @ignore void + */ + abstract public function __set($propertyName, $propertyValue); + + /** + * Construct a new options object. + * Options are constructed from an option array by default. The constructor + * automatically passes the given options to the __set() method to set them + * in the class. + * + * @param array(string=>mixed) $options The initial options to set. + * @return void + * + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + * @throws ezcBaseValueException + * If a the value for a property is out of range. + */ + public function __construct(array $options = array()) + { + foreach ($options as $option => $value) { + $this->__set($option, $value); + } + } + + /** + * Merge an array into the actual options object. + * This method merges an array of new options into the actual options object. + * + * @param array $newOptions The new options. + * @return void + * + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + * @throws ezcBaseValueException + * If a the value for a property is out of range. + */ + public function merge(array $newOptions) + { + foreach ($newOptions as $key => $value) { + $this->__set($key, $value); + } + } + + /** + * Property get access. + * Simply returns a given option. + * + * @param string $propertyName The name of the option to get. + * @return mixed The option value. + * + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + */ + public function __get($propertyName) + { + if (isset($this->properties[$propertyName])) { + return $this->properties[$propertyName]; + } + throw new ezcBasePropertyNotFoundException($propertyName); + } + + /** + * Returns if an option exists. + * Allows isset() using ArrayAccess. + * + * @param string $propertyName The name of the option to get. + * @return bool Wether the option exists. + */ + public function offsetExists($propertyName) + { + return isset($this->properties[$propertyName]); + } + + /** + * Returns an option value. + * Get an option value by ArrayAccess. + * + * @param string $propertyName The name of the option to get. + * @return mixed The option value. + * + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + */ + public function offsetGet($propertyName) + { + return $this->__get($propertyName); + } + + /** + * Set an option. + * Sets an option using ArrayAccess. + * + * @param string $propertyName The option to set. + * @param mixed $propertyValue The value for the option. + * @return void + * + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + * @throws ezcBaseValueException + * If a the value for a property is out of range. + */ + public function offsetSet($propertyName, $propertyValue) + { + $this->__set($propertyName, $propertyValue); + } + + /** + * Unset an option. + * Unsets an option using ArrayAccess. + * + * @param string $propertyName The options to unset. + * @return void + * + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + * @throws ezcBaseValueException + * If a the value for a property is out of range. + */ + public function offsetUnset($propertyName) + { + $this->__set($propertyName, null); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/struct.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/struct.php index 38477943a0176cf35f711714548221022201ab9d..d3cb5950c45575db7b11f99e1634f03fd8bf7aa5 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/struct.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/src/struct.php @@ -1,35 +1,34 @@ - +assertEquals( "The setting is not a valid configuration setting.", $e->getMessage() ); - } - } - - public function testConfigExceptionOutOfRange1() - { - try - { - throw new ezcBaseSettingValueException( 'broken', 42 ); - } - catch ( ezcBaseSettingValueException $e ) - { - $this->assertEquals( "The value <42> that you were trying to assign to setting is invalid.", $e->getMessage() ); - } - } - - public function testConfigExceptionOutOfRange2() - { - try - { - throw new ezcBaseSettingValueException( 'broken', 42, "int, 40 - 48" ); - } - catch ( ezcBaseSettingValueException $e ) - { - $this->assertEquals( "The value <42> that you were trying to assign to setting is invalid. Allowed values are: int, 40 - 48", $e->getMessage() ); - } - } - - public function testFileIoException1() - { - try - { - throw new ezcBaseFileIoException( 'testfile.php', ezcBaseFileException::READ ); - } - catch ( ezcBaseFileIoException $e ) - { - $this->assertEquals( "An error occurred while reading from .", $e->getMessage() ); - } - } - - public function testFileIoException2() - { - try - { - throw new ezcBaseFileIoException( 'testfile.php', ezcBaseFileException::WRITE ); - } - catch ( ezcBaseFileIoException $e ) - { - $this->assertEquals( "An error occurred while writing to .", $e->getMessage() ); - } - } - - public function testFileIoException3() - { - try - { - throw new ezcBaseFileIoException( 'testfile.php', ezcBaseFileException::WRITE, "Extra extra" ); - } - catch ( ezcBaseFileIoException $e ) - { - $this->assertEquals( "An error occurred while writing to . (Extra extra)", $e->getMessage() ); - } - } - - public function testFileNotFoundException1() - { - try - { - throw new ezcBaseFileNotFoundException( 'testfile.php' ); - } - catch ( ezcBaseFileNotFoundException $e ) - { - $this->assertEquals( "The file could not be found.", $e->getMessage() ); - } - } - - public function testFileNotFoundException2() - { - try - { - throw new ezcBaseFileNotFoundException( 'testfile.php', 'INI' ); - } - catch ( ezcBaseFileNotFoundException $e ) - { - $this->assertEquals( "The INI file could not be found.", $e->getMessage() ); - } - } - - public function testFileNotFoundException3() - { - try - { - throw new ezcBaseFileNotFoundException( 'testfile.php', 'INI', "Extra extra" ); - } - catch ( ezcBaseFileNotFoundException $e ) - { - $this->assertEquals( "The INI file could not be found. (Extra extra)", $e->getMessage() ); - } - } - - public function testFilePermissionException1() - { - try - { - throw new ezcBaseFilePermissionException( 'testfile.php', ezcBaseFileException::READ ); - } - catch ( ezcBaseFilePermissionException $e ) - { - $this->assertEquals( "The file can not be opened for reading.", $e->getMessage() ); - } - } - - public function testFilePermissionException2() - { - try - { - throw new ezcBaseFilePermissionException( 'testfile.php', ezcBaseFileException::WRITE ); - } - catch ( ezcBaseFileException $e ) - { - $this->assertEquals( "The file can not be opened for writing.", $e->getMessage() ); - } - } - - public function testFilePermissionException3() - { - try - { - throw new ezcBaseFilePermissionException( 'testfile.php', ezcBaseFileException::EXECUTE ); - } - catch ( ezcBaseException $e ) - { - $this->assertEquals( "The file can not be executed.", $e->getMessage() ); - } - } - - public function testFilePermissionException4() - { - try - { - throw new ezcBaseFilePermissionException( 'testfile.php', ezcBaseFilePermissionException::CHANGE, "Extra extra" ); - } - catch ( ezcBaseException $e ) - { - $this->assertEquals( "The permissions for can not be changed. (Extra extra)", $e->getMessage() ); - } - } - - public function testFilePermissionException5() - { - try - { - throw new ezcBaseFilePermissionException( 'testfile.php', ezcBaseFilePermissionException::READ | ezcBaseFilePermissionException::WRITE, "Extra extra" ); - } - catch ( ezcBaseException $e ) - { - $this->assertEquals( "The file can not be opened for reading and writing. (Extra extra)", $e->getMessage() ); - } - } - - public function testPropertyNotFoundException() - { - try - { - throw new ezcBasePropertyNotFoundException( 'broken' ); - } - catch ( ezcBasePropertyNotFoundException $e ) - { - $this->assertEquals( "No such property name .", $e->getMessage() ); - } - } - - public function testPropertyPermissionException1() - { - try - { - throw new ezcBasePropertyPermissionException( 'broken', ezcBasePropertyPermissionException::READ ); - } - catch ( ezcBaseException $e ) - { - $this->assertEquals( "The property is read-only.", $e->getMessage() ); - } - } - - public function testPropertyPermissionException2() - { - try - { - throw new ezcBasePropertyPermissionException( 'broken', ezcBasePropertyPermissionException::WRITE ); - } - catch ( ezcBaseException $e ) - { - $this->assertEquals( "The property is write-only.", $e->getMessage() ); - } - } - - public function testBaseValue1() - { - try - { - throw new ezcBaseValueException( 'broken', array( 42 ) ); - } - catch ( ezcBaseValueException $e ) - { - $this->assertEquals( "The value that you were trying to assign to setting is invalid.", $e->getMessage() ); - } - } - - public function testBaseValue2() - { - try - { - throw new ezcBaseValueException( 'broken', "string", "strings" ); - } - catch ( ezcBaseValueException $e ) - { - $this->assertEquals( "The value that you were trying to assign to setting is invalid. Allowed values are: strings.", $e->getMessage() ); - $this->assertEquals( "The value that you were trying to assign to setting is invalid. Allowed values are: strings.", $e->originalMessage ); - } - } - - public function testExtraDirNotFoundException() - { - try - { - ezcBase::addClassRepository( 'wrongDir' ); - } - catch ( ezcBaseFileNotFoundException $e ) - { - $this->assertEquals( "The base directory file could not be found.", $e->getMessage() ); - } - } - - public function testExtraDirBaseNotFoundException() - { - try - { - ezcBase::addClassRepository( '.', './wrongAutoloadDir' ); - } - catch ( ezcBaseFileNotFoundException $e ) - { - $this->assertEquals( "The autoload directory file <./wrongAutoloadDir> could not be found.", $e->getMessage() ); - } - } - - public function testBaseAddAndGetAutoloadDirs1() - { - ezcBase::addClassRepository( '.' ); - $resultArray = ezcBase::getRepositoryDirectories(); - - if ( count( $resultArray ) != 2 ) - { - $this->fail( "Duplicating or missing extra autoload dirs while adding." ); - } - - $packageDir = realpath( dirname( __FILE__ ) . '/../..' ); - if ( !isset( $resultArray[$packageDir] ) ) - { - $this->fail( "No packageDir found in result of getRepositoryDirectories()" ); - } - - if ( !isset( $resultArray['.'] ) || $resultArray['.'][1] != './autoload' ) - { - $this->fail( "Extra autoload dir <{$resultArray['.'][1]}> is added incorrectly" ); - } - } - - public function testBaseAddAndGetAutoloadDirs2() - { - ezcBase::addClassRepository( '.', './autoload' ); - ezcBase::addClassRepository( './Base/tests/test_repository', './Base/tests/test_repository/autoload_files' ); - ezcBase::addClassRepository( './Base/tests/test_repository', './Base/tests/test_repository/autoload_files' ); - $resultArray = ezcBase::getRepositoryDirectories(); - - if ( count( $resultArray ) != 3 ) - { - $this->fail( "Duplicating or missing extra autoload dirs while adding." ); - } - - $packageDir = realpath( dirname( __FILE__ ) . '/../..' ); - if ( !isset( $resultArray[$packageDir] ) ) - { - $this->fail( "No packageDir found in result of getRepositoryDirectories()" ); - } - - if ( !isset( $resultArray['./Base/tests/test_repository'] ) || $resultArray['./Base/tests/test_repository'][1] != './Base/tests/test_repository/autoload_files' ) - { - $this->fail( "Extra autoload dir <{$resultArray['./Base/tests/test_repository'][1]}> is added incorrectly" ); - } - - self::assertEquals( true, class_exists( 'trBasetestClass', true ) ); - self::assertEquals( true, class_exists( 'trBasetestClass2', true ) ); - self::assertEquals( false, @class_exists( 'trBasetestClass3', true ) ); - } - - public function testNoPrefixAutoload() - { - ezcBase::addClassRepository( './Base/tests/test_repository', './Base/tests/test_repository/autoload_files' ); - __autoload( 'Object' ); - if( !class_exists( 'Object' ) ) - { - $this->fail( "Autoload does not handle classes with no prefix" ); - } - } - - public static function suite() - { - return new ezcTestSuite("ezcBaseTest"); - } -} -?> +assertEquals("The setting is not a valid configuration setting.", $e->getMessage()); + } + } + + public function testConfigExceptionOutOfRange1() + { + try { + throw new ezcBaseSettingValueException('broken', 42); + } catch (ezcBaseSettingValueException $e) { + $this->assertEquals("The value <42> that you were trying to assign to setting is invalid.", $e->getMessage()); + } + } + + public function testConfigExceptionOutOfRange2() + { + try { + throw new ezcBaseSettingValueException('broken', 42, "int, 40 - 48"); + } catch (ezcBaseSettingValueException $e) { + $this->assertEquals("The value <42> that you were trying to assign to setting is invalid. Allowed values are: int, 40 - 48", $e->getMessage()); + } + } + + public function testFileIoException1() + { + try { + throw new ezcBaseFileIoException('testfile.php', ezcBaseFileException::READ); + } catch (ezcBaseFileIoException $e) { + $this->assertEquals("An error occurred while reading from .", $e->getMessage()); + } + } + + public function testFileIoException2() + { + try { + throw new ezcBaseFileIoException('testfile.php', ezcBaseFileException::WRITE); + } catch (ezcBaseFileIoException $e) { + $this->assertEquals("An error occurred while writing to .", $e->getMessage()); + } + } + + public function testFileIoException3() + { + try { + throw new ezcBaseFileIoException('testfile.php', ezcBaseFileException::WRITE, "Extra extra"); + } catch (ezcBaseFileIoException $e) { + $this->assertEquals("An error occurred while writing to . (Extra extra)", $e->getMessage()); + } + } + + public function testFileNotFoundException1() + { + try { + throw new ezcBaseFileNotFoundException('testfile.php'); + } catch (ezcBaseFileNotFoundException $e) { + $this->assertEquals("The file could not be found.", $e->getMessage()); + } + } + + public function testFileNotFoundException2() + { + try { + throw new ezcBaseFileNotFoundException('testfile.php', 'INI'); + } catch (ezcBaseFileNotFoundException $e) { + $this->assertEquals("The INI file could not be found.", $e->getMessage()); + } + } + + public function testFileNotFoundException3() + { + try { + throw new ezcBaseFileNotFoundException('testfile.php', 'INI', "Extra extra"); + } catch (ezcBaseFileNotFoundException $e) { + $this->assertEquals("The INI file could not be found. (Extra extra)", $e->getMessage()); + } + } + + public function testFilePermissionException1() + { + try { + throw new ezcBaseFilePermissionException('testfile.php', ezcBaseFileException::READ); + } catch (ezcBaseFilePermissionException $e) { + $this->assertEquals("The file can not be opened for reading.", $e->getMessage()); + } + } + + public function testFilePermissionException2() + { + try { + throw new ezcBaseFilePermissionException('testfile.php', ezcBaseFileException::WRITE); + } catch (ezcBaseFileException $e) { + $this->assertEquals("The file can not be opened for writing.", $e->getMessage()); + } + } + + public function testFilePermissionException3() + { + try { + throw new ezcBaseFilePermissionException('testfile.php', ezcBaseFileException::EXECUTE); + } catch (ezcBaseException $e) { + $this->assertEquals("The file can not be executed.", $e->getMessage()); + } + } + + public function testFilePermissionException4() + { + try { + throw new ezcBaseFilePermissionException('testfile.php', ezcBaseFilePermissionException::CHANGE, "Extra extra"); + } catch (ezcBaseException $e) { + $this->assertEquals("The permissions for can not be changed. (Extra extra)", $e->getMessage()); + } + } + + public function testFilePermissionException5() + { + try { + throw new ezcBaseFilePermissionException('testfile.php', ezcBaseFilePermissionException::READ | ezcBaseFilePermissionException::WRITE, "Extra extra"); + } catch (ezcBaseException $e) { + $this->assertEquals("The file can not be opened for reading and writing. (Extra extra)", $e->getMessage()); + } + } + + public function testPropertyNotFoundException() + { + try { + throw new ezcBasePropertyNotFoundException('broken'); + } catch (ezcBasePropertyNotFoundException $e) { + $this->assertEquals("No such property name .", $e->getMessage()); + } + } + + public function testPropertyPermissionException1() + { + try { + throw new ezcBasePropertyPermissionException('broken', ezcBasePropertyPermissionException::READ); + } catch (ezcBaseException $e) { + $this->assertEquals("The property is read-only.", $e->getMessage()); + } + } + + public function testPropertyPermissionException2() + { + try { + throw new ezcBasePropertyPermissionException('broken', ezcBasePropertyPermissionException::WRITE); + } catch (ezcBaseException $e) { + $this->assertEquals("The property is write-only.", $e->getMessage()); + } + } + + public function testBaseValue1() + { + try { + throw new ezcBaseValueException('broken', array( 42 )); + } catch (ezcBaseValueException $e) { + $this->assertEquals("The value that you were trying to assign to setting is invalid.", $e->getMessage()); + } + } + + public function testBaseValue2() + { + try { + throw new ezcBaseValueException('broken', "string", "strings"); + } catch (ezcBaseValueException $e) { + $this->assertEquals("The value that you were trying to assign to setting is invalid. Allowed values are: strings.", $e->getMessage()); + $this->assertEquals("The value that you were trying to assign to setting is invalid. Allowed values are: strings.", $e->originalMessage); + } + } + + public function testExtraDirNotFoundException() + { + try { + ezcBase::addClassRepository('wrongDir'); + } catch (ezcBaseFileNotFoundException $e) { + $this->assertEquals("The base directory file could not be found.", $e->getMessage()); + } + } + + public function testExtraDirBaseNotFoundException() + { + try { + ezcBase::addClassRepository('.', './wrongAutoloadDir'); + } catch (ezcBaseFileNotFoundException $e) { + $this->assertEquals("The autoload directory file <./wrongAutoloadDir> could not be found.", $e->getMessage()); + } + } + + public function testBaseAddAndGetAutoloadDirs1() + { + ezcBase::addClassRepository('.'); + $resultArray = ezcBase::getRepositoryDirectories(); + + if (count($resultArray) != 2) { + $this->fail("Duplicating or missing extra autoload dirs while adding."); + } + + $packageDir = realpath(dirname(__FILE__) . '/../..'); + if (!isset($resultArray[$packageDir])) { + $this->fail("No packageDir found in result of getRepositoryDirectories()"); + } + + if (!isset($resultArray['.']) || $resultArray['.'][1] != './autoload') { + $this->fail("Extra autoload dir <{$resultArray['.'][1]}> is added incorrectly"); + } + } + + public function testBaseAddAndGetAutoloadDirs2() + { + ezcBase::addClassRepository('.', './autoload'); + ezcBase::addClassRepository('./Base/tests/test_repository', './Base/tests/test_repository/autoload_files'); + ezcBase::addClassRepository('./Base/tests/test_repository', './Base/tests/test_repository/autoload_files'); + $resultArray = ezcBase::getRepositoryDirectories(); + + if (count($resultArray) != 3) { + $this->fail("Duplicating or missing extra autoload dirs while adding."); + } + + $packageDir = realpath(dirname(__FILE__) . '/../..'); + if (!isset($resultArray[$packageDir])) { + $this->fail("No packageDir found in result of getRepositoryDirectories()"); + } + + if (!isset($resultArray['./Base/tests/test_repository']) || $resultArray['./Base/tests/test_repository'][1] != './Base/tests/test_repository/autoload_files') { + $this->fail("Extra autoload dir <{$resultArray['./Base/tests/test_repository'][1]}> is added incorrectly"); + } + + self::assertEquals(true, class_exists('trBasetestClass', true)); + self::assertEquals(true, class_exists('trBasetestClass2', true)); + self::assertEquals(false, @class_exists('trBasetestClass3', true)); + } + + public function testNoPrefixAutoload() + { + ezcBase::addClassRepository('./Base/tests/test_repository', './Base/tests/test_repository/autoload_files'); + __autoload('Object'); + if (!class_exists('Object')) { + $this->fail("Autoload does not handle classes with no prefix"); + } + } + + public static function suite() + { + return new ezcTestSuite("ezcBaseTest"); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/suite.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/suite.php index 45dd2748c15bca02dded6a455df7696cf4060388..41b0030bff0ee0c56e7b1fb06efa55261b549e08 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/suite.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/suite.php @@ -1,31 +1,30 @@ -setName("Base"); - - $this->addTest( ezcBaseTest::suite() ); - } - - public static function suite() - { - return new ezcBaseSuite(); - } -} -?> +setName("Base"); + + $this->addTest(ezcBaseTest::suite()); + } + + public static function suite() + { + return new ezcBaseSuite(); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/test_repository/TestClasses/base_test_class.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/test_repository/TestClasses/base_test_class.php index cfd6f69b41437c2d50b343d4949ed5272be4ab22..8f305bdf614cc8d2de4f7f7e5329dc951da6620d 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/test_repository/TestClasses/base_test_class.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/test_repository/TestClasses/base_test_class.php @@ -1,4 +1,4 @@ - + + 'TestClasses/base_test_class.php', - 'trBasetestClass2' => 'TestClasses/base_test_class_number_two.php' -); -?> + 'TestClasses/base_test_class.php', + 'trBasetestClass2' => 'TestClasses/base_test_class_number_two.php' +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/test_repository/autoload_files/object_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/test_repository/autoload_files/object_autoload.php index d66e206489da589652285e0f6b7fc28f32fb3033..e76f6791b81333a4c04207b5cc2fd7a440ba2f09 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/test_repository/autoload_files/object_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/test_repository/autoload_files/object_autoload.php @@ -1,5 +1,4 @@ - 'object/object.php', -); -?> + 'object/object.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/test_repository/object/object.php b/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/test_repository/object/object.php index d6a367126fb3be3bb4faff0675ca1d524e1e26b8..0c6af1c4a13c36e85acd62ef548598d770370ec2 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/test_repository/object/object.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/Base/tests/test_repository/object/object.php @@ -1,4 +1,4 @@ - +registerOption( new ezcConsoleOption( 'h', 'help' ) ); - -// Register complex parameter -f/--file -$file = new ezcConsoleOption( - 'f', - 'file', - ezcConsoleInput::TYPE_STRING, - null, - false, - 'Process a file.', - 'Processes a single file.' -); -$optionHandler->registerOption( $file ); - -// Manipulate parameter -f/--file after registration -$file->multiple = true; - -// Register another complex parameter that depends on -f and excludes -h -$dir = new ezcConsoleOption( - 'd', - 'dir', - ezcConsoleInput::TYPE_STRING, - null, - true, - 'Process a directory.', - 'Processes a complete directory.', - array( new ezcConsoleOptionRule( $optionHandler->getOption( 'f' ) ) ), - array( new ezcConsoleOptionRule( $optionHandler->getOption( 'h' ) ) ) -); -$optionHandler->registerOption( $dir ); - -// Register an alias for this parameter -$optionHandler->registerAlias( 'e', 'extended-dir', $dir ); - -// Process registered parameters and handle errors -try -{ - $optionHandler->process( array( 'example_input.php', '-h' ) ); -} -catch ( ezcConsoleOptionException $e ) -{ - echo $e->getMessage(); - exit( 1 ); -} - -// Process a single parameter -$file = $optionHandler->getOption( 'f' ); -if ( $file->value === false ) -{ - echo "Parameter -{$file->short}/--{$file->long} was not submitted.\n"; -} -elseif ( $file->value === true ) -{ - echo "Parameter -{$file->short}/--{$file->long} was submitted without value.\n"; -} -else -{ - echo "Parameter -{$file->short}/--{$file->long} was submitted with value <".var_export($file->value, true).">.\n"; -} - -// Process all parameters at once: -foreach ( $optionHandler->getOptionValues() as $paramShort => $val ) -{ - switch ( true ) - { - case $val === false: - echo "Parameter $paramShort was not submitted.\n"; - break; - case $val === true: - echo "Parameter $paramShort was submitted without a value.\n"; - break; - case is_array( $val ): - echo "Parameter $paramShort was submitted multiple times with value: <".implode(', ', $val).">.\n"; - break; - default: - echo "Parameter $paramShort was submitted with value: <$val>.\n"; - break; - } -} -?> +registerOption(new ezcConsoleOption('h', 'help')); + +// Register complex parameter -f/--file +$file = new ezcConsoleOption( + 'f', + 'file', + ezcConsoleInput::TYPE_STRING, + null, + false, + 'Process a file.', + 'Processes a single file.' +); +$optionHandler->registerOption($file); + +// Manipulate parameter -f/--file after registration +$file->multiple = true; + +// Register another complex parameter that depends on -f and excludes -h +$dir = new ezcConsoleOption( + 'd', + 'dir', + ezcConsoleInput::TYPE_STRING, + null, + true, + 'Process a directory.', + 'Processes a complete directory.', + array( new ezcConsoleOptionRule($optionHandler->getOption('f')) ), + array( new ezcConsoleOptionRule($optionHandler->getOption('h')) ) +); +$optionHandler->registerOption($dir); + +// Register an alias for this parameter +$optionHandler->registerAlias('e', 'extended-dir', $dir); + +// Process registered parameters and handle errors +try { + $optionHandler->process(array( 'example_input.php', '-h' )); +} catch (ezcConsoleOptionException $e) { + echo $e->getMessage(); + exit(1); +} + +// Process a single parameter +$file = $optionHandler->getOption('f'); +if ($file->value === false) { + echo "Parameter -{$file->short}/--{$file->long} was not submitted.\n"; +} elseif ($file->value === true) { + echo "Parameter -{$file->short}/--{$file->long} was submitted without value.\n"; +} else { + echo "Parameter -{$file->short}/--{$file->long} was submitted with value <".var_export($file->value, true).">.\n"; +} + +// Process all parameters at once: +foreach ($optionHandler->getOptionValues() as $paramShort => $val) { + switch (true) { + case $val === false: + echo "Parameter $paramShort was not submitted.\n"; + break; + case $val === true: + echo "Parameter $paramShort was submitted without a value.\n"; + break; + case is_array($val): + echo "Parameter $paramShort was submitted multiple times with value: <".implode(', ', $val).">.\n"; + break; + default: + echo "Parameter $paramShort was submitted with value: <$val>.\n"; + break; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_output.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_output.php index 22692e5baed614cd2b26f6ff8ca1d383d8185d9c..008734877592d804b5db6c94e4d60d5f728861fb 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_output.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_output.php @@ -1,64 +1,62 @@ -options->verbosityLevel = 10; -// Enable auto wrapping of lines after 40 characters -$out->options->autobreak = 40; - -// Set the color of the default output format to green -$out->formats->default->color = 'green'; - -// Set the color of the output format named 'success' to white -$out->formats->success->color = 'white'; -// Set the style of the output format named 'success' to bold -$out->formats->success->style = array( 'bold' ); - -// Set the color of the output format named 'failure' to red -$out->formats->failure->color = 'red'; -// Set the style of the output format named 'failure' to bold -$out->formats->failure->style = array( 'bold' ); -// Set the background color of the output format named 'failure' to blue -$out->formats->failure->bgcolor = 'blue'; - -// Output text with default format -$out->outputText( 'This is default text ' ); -// Output text with format 'success' -$out->outputText( 'including success message', 'success' ); -// Some more output with default output. -$out->outputText( "and a manual linebreak.\n" ); - -// Manipulate the later output -$out->formats->success->color = 'green'; -$out->formats->default->color = 'blue'; - -// This is visible, since we set verboseLevel to 10, and printed in default format (now blue) -$out->outputText( "Some verbose output.\n", null, 10 ); -// This is not visible, since we set verboseLevel to 10 -$out->outputText( "Some more verbose output.\n", null, 20 ); -// This is visible, since we set verboseLevel to 10, and printed in format 'failure' -$out->outputText( "And some not so verbose, failure output.\n", 'failure', 5 ); - -?> +options->verbosityLevel = 10; +// Enable auto wrapping of lines after 40 characters +$out->options->autobreak = 40; + +// Set the color of the default output format to green +$out->formats->default->color = 'green'; + +// Set the color of the output format named 'success' to white +$out->formats->success->color = 'white'; +// Set the style of the output format named 'success' to bold +$out->formats->success->style = array( 'bold' ); + +// Set the color of the output format named 'failure' to red +$out->formats->failure->color = 'red'; +// Set the style of the output format named 'failure' to bold +$out->formats->failure->style = array( 'bold' ); +// Set the background color of the output format named 'failure' to blue +$out->formats->failure->bgcolor = 'blue'; + +// Output text with default format +$out->outputText('This is default text '); +// Output text with format 'success' +$out->outputText('including success message', 'success'); +// Some more output with default output. +$out->outputText("and a manual linebreak.\n"); + +// Manipulate the later output +$out->formats->success->color = 'green'; +$out->formats->default->color = 'blue'; + +// This is visible, since we set verboseLevel to 10, and printed in default format (now blue) +$out->outputText("Some verbose output.\n", null, 10); +// This is not visible, since we set verboseLevel to 10 +$out->outputText("Some more verbose output.\n", null, 20); +// This is visible, since we set verboseLevel to 10, and printed in format 'failure' +$out->outputText("And some not so verbose, failure output.\n", 'failure', 5); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_progressbar.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_progressbar.php index da2f497add5e99f7d7fe8782c34336e139de9081..35fa1cb2e734f37a40117a10d9f006cba098806f 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_progressbar.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_progressbar.php @@ -1,75 +1,73 @@ -formats->red->color = "red"; - -// Create progress bar itself -$progress = new ezcConsoleProgressbar( $out, 100, array( 'step' => 5 ) ); - -$progress->options->emptyChar = '-'; -$progress->options->progressChar = $out->formatText('>', "red"); -$progress->options->formatString = "Uploading file : %act%/%max% kb [%bar%]"; - -// Perform actions -$i = 0; -while( $i++ < 20 ) -{ - // Do whatever you want to indicate progress for - usleep( mt_rand( 20000, 2000000 ) ); - // Advance the progressbar by one step ( uploading 5k per run ) - $progress->advance(); -} - -// Finish progress bar and jump to next line. -$progress->finish(); - -$out->outputText( "Successfully uploaded .\n", 'success' ); - -/* -OUTPUT: (sequential, will be printed into 1 line and updated in reallife) - -Uploading file : 5/100 kb [++#----------------------------------------------] -Uploading file : 10/100 kb [+++++#-------------------------------------------] -Uploading file : 15/100 kb [++++++++#----------------------------------------] -Uploading file : 20/100 kb [+++++++++++#-------------------------------------] -Uploading file : 25/100 kb [++++++++++++++#----------------------------------] -Uploading file : 30/100 kb [+++++++++++++++++#-------------------------------] -Uploading file : 35/100 kb [++++++++++++++++++++#----------------------------] -Uploading file : 40/100 kb [+++++++++++++++++++++++#-------------------------] -Uploading file : 45/100 kb [++++++++++++++++++++++++++#----------------------] -Uploading file : 50/100 kb [+++++++++++++++++++++++++++++#-------------------] -Uploading file : 55/100 kb [++++++++++++++++++++++++++++++++#----------------] -Uploading file : 60/100 kb [+++++++++++++++++++++++++++++++++++#-------------] -Uploading file : 65/100 kb [++++++++++++++++++++++++++++++++++++++#----------] -Uploading file : 70/100 kb [+++++++++++++++++++++++++++++++++++++++++#-------] -Uploading file : 75/100 kb [++++++++++++++++++++++++++++++++++++++++++++#----] -Uploading file : 80/100 kb [+++++++++++++++++++++++++++++++++++++++++++++++#-] -Uploading file : 85/100 kb [++++++++++++++++++++++++++++++++++++++++++++++++#] -Uploading file : 90/100 kb [++++++++++++++++++++++++++++++++++++++++++++++++#] -Uploading file : 95/100 kb [++++++++++++++++++++++++++++++++++++++++++++++++#] -Uploading file : 100/100 kb [++++++++++++++++++++++++++++++++++++++++++++++++#] -Uploading file : 100/100 kb [++++++++++++++++++++++++++++++++++++++++++++++++#]Successfully uploaded . - -*/ -?> +formats->red->color = "red"; + +// Create progress bar itself +$progress = new ezcConsoleProgressbar($out, 100, array( 'step' => 5 )); + +$progress->options->emptyChar = '-'; +$progress->options->progressChar = $out->formatText('>', "red"); +$progress->options->formatString = "Uploading file : %act%/%max% kb [%bar%]"; + +// Perform actions +$i = 0; +while ($i++ < 20) { + // Do whatever you want to indicate progress for + usleep(mt_rand(20000, 2000000)); + // Advance the progressbar by one step ( uploading 5k per run ) + $progress->advance(); +} + +// Finish progress bar and jump to next line. +$progress->finish(); + +$out->outputText("Successfully uploaded .\n", 'success'); + +/* +OUTPUT: (sequential, will be printed into 1 line and updated in reallife) + +Uploading file : 5/100 kb [++#----------------------------------------------] +Uploading file : 10/100 kb [+++++#-------------------------------------------] +Uploading file : 15/100 kb [++++++++#----------------------------------------] +Uploading file : 20/100 kb [+++++++++++#-------------------------------------] +Uploading file : 25/100 kb [++++++++++++++#----------------------------------] +Uploading file : 30/100 kb [+++++++++++++++++#-------------------------------] +Uploading file : 35/100 kb [++++++++++++++++++++#----------------------------] +Uploading file : 40/100 kb [+++++++++++++++++++++++#-------------------------] +Uploading file : 45/100 kb [++++++++++++++++++++++++++#----------------------] +Uploading file : 50/100 kb [+++++++++++++++++++++++++++++#-------------------] +Uploading file : 55/100 kb [++++++++++++++++++++++++++++++++#----------------] +Uploading file : 60/100 kb [+++++++++++++++++++++++++++++++++++#-------------] +Uploading file : 65/100 kb [++++++++++++++++++++++++++++++++++++++#----------] +Uploading file : 70/100 kb [+++++++++++++++++++++++++++++++++++++++++#-------] +Uploading file : 75/100 kb [++++++++++++++++++++++++++++++++++++++++++++#----] +Uploading file : 80/100 kb [+++++++++++++++++++++++++++++++++++++++++++++++#-] +Uploading file : 85/100 kb [++++++++++++++++++++++++++++++++++++++++++++++++#] +Uploading file : 90/100 kb [++++++++++++++++++++++++++++++++++++++++++++++++#] +Uploading file : 95/100 kb [++++++++++++++++++++++++++++++++++++++++++++++++#] +Uploading file : 100/100 kb [++++++++++++++++++++++++++++++++++++++++++++++++#] +Uploading file : 100/100 kb [++++++++++++++++++++++++++++++++++++++++++++++++#]Successfully uploaded . + +*/ diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_progressmonitor.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_progressmonitor.php index a1a2489599a330c53b67e68f20ad6020204d9f7c..480e16b9ec179295a8ba6c30dd3ef7b1b42a770c 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_progressmonitor.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_progressmonitor.php @@ -1,52 +1,50 @@ -addEntry( 'ACTION', "Performed action #{$i}." ); -} - -$out->outputLine(); - -/* -OUTPUT: - - 14.3% ACTION Performed action #1. - 28.6% ACTION Performed action #2. - 42.9% ACTION Performed action #3. - 57.1% ACTION Performed action #4. - 71.4% ACTION Performed action #5. - 85.7% ACTION Performed action #6. - 100.0% ACTION Performed action #7. - -*/ -?> +addEntry('ACTION', "Performed action #{$i}."); +} + +$out->outputLine(); + +/* +OUTPUT: + + 14.3% ACTION Performed action #1. + 28.6% ACTION Performed action #2. + 42.9% ACTION Performed action #3. + 57.1% ACTION Performed action #4. + 71.4% ACTION Performed action #5. + 85.7% ACTION Performed action #6. + 100.0% ACTION Performed action #7. + +*/ diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_statusbar.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_statusbar.php index 52d063ef2d129bbb46ebfe23933cf191752351f6..1ffca8ab4bc3c5dee0bb7f8837acd6987d2ab8f9 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_statusbar.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_statusbar.php @@ -1,49 +1,47 @@ -add( (bool)mt_rand( 0, 1 ) ); -} - -$out->outputLine(); -// Print statistics -$out->outputLine( $status->getSuccessCount() . ' operations succeeded, ' . $status->getFailureCount() . ' failed.' ); - -/* -OUTPUT: - -+-++++-++++-++-+--+- -13 operations succeeded, 7 failed. - -*/ -?> +add((bool)mt_rand(0, 1)); +} + +$out->outputLine(); +// Print statistics +$out->outputLine($status->getSuccessCount() . ' operations succeeded, ' . $status->getFailureCount() . ' failed.'); + +/* +OUTPUT: + ++-++++-++++-++-+--+- +13 operations succeeded, 7 failed. + +*/ diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_table.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_table.php index bc88ab177cfaa191b5c2cce87225c275ca69ba7c..fbef79e322ee92ff49435221f6c147689195132e 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_table.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_table.php @@ -1,77 +1,74 @@ -formats->headline->color = 'red'; -$out->formats->headline->style = array( 'bold' ); -// Define a new format "sum" -$out->formats->sum->color = 'blue'; -$out->formats->sum->style = array( 'negative' ); - -// Create a new table -$table = new ezcConsoleTable( $out, 60 ); - -// Create first row and in it the first cell -$table[0][0]->content = 'Headline 1'; - -// Create 3 more cells in row 0 -for ( $i = 2; $i < 5; $i++ ) -{ - $table[0][]->content = "Headline $i"; -} - -$data = array( 1, 2, 3, 4 ); - -// Create some more data in the table... -foreach ( $data as $value ) -{ - // Create a new row each time and set it's contents to the actual value - $table[][0]->content = $value; -} - -// Set another border format for our headline row -$table[0]->borderFormat = 'headline'; - -// Set the content format for all cells of the 3rd row to "sum" -$table[2]->format = 'sum'; - -$table->outputTable(); -echo "\n"; -/* - -RESULT (without color): - -+------------+------------+------------+------------+ // -| Headline 1 | Headline 2 | Headline 3 | Headline 4 | // Red bordered line -+------------+------------+------------+------------+ // -| 1 | | | | -+------------+------------+------------+------------+ -| 2 | | | | // Content printed in white on blue -+------------+------------+------------+------------+ -| 3 | | | | -+------------+------------+------------+------------+ -| 4 | | | | -+------------+------------+------------+------------+ - -*/ -?> +formats->headline->color = 'red'; +$out->formats->headline->style = array( 'bold' ); +// Define a new format "sum" +$out->formats->sum->color = 'blue'; +$out->formats->sum->style = array( 'negative' ); + +// Create a new table +$table = new ezcConsoleTable($out, 60); + +// Create first row and in it the first cell +$table[0][0]->content = 'Headline 1'; + +// Create 3 more cells in row 0 +for ($i = 2; $i < 5; $i++) { + $table[0][]->content = "Headline $i"; +} + +$data = array( 1, 2, 3, 4 ); + +// Create some more data in the table... +foreach ($data as $value) { + // Create a new row each time and set it's contents to the actual value + $table[][0]->content = $value; +} + +// Set another border format for our headline row +$table[0]->borderFormat = 'headline'; + +// Set the content format for all cells of the 3rd row to "sum" +$table[2]->format = 'sum'; + +$table->outputTable(); +echo "\n"; +/* + +RESULT (without color): + ++------------+------------+------------+------------+ // +| Headline 1 | Headline 2 | Headline 3 | Headline 4 | // Red bordered line ++------------+------------+------------+------------+ // +| 1 | | | | ++------------+------------+------------+------------+ +| 2 | | | | // Content printed in white on blue ++------------+------------+------------+------------+ +| 3 | | | | ++------------+------------+------------+------------+ +| 4 | | | | ++------------+------------+------------+------------+ + +*/ diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_table_2.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_table_2.php index c41c8cc96e843b0f06b86b45dff2e6952d666d6b..4e47c34caee26b5ac25377ff114c068cd8538f97 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_table_2.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/example_table_2.php @@ -1,65 +1,61 @@ -formats->evenRow->color = 'red'; -$out->formats->evenRow->style = array( 'bold' ); - -$out->formats->oddRow->color = 'blue'; -$out->formats->oddRow->style = array( 'bold' ); - -// Define format schemes for even and odd cells -$out->formats->evenCell->color = 'red'; -$out->formats->evenCell->style = array( 'negative' ); - -$out->formats->oddCell->color = 'blue'; -$out->formats->oddCell->style = array( 'negative' ); - -// Create a new table with a width of 60 chars -$table = new ezcConsoleTable( $out, 60 ); - -// Set global cell content align -$table->options->defaultAlign = ezcConsoleTable::ALIGN_CENTER; - -for ( $i = 0; $i < 5; $i ++ ) -{ - for ( $j = 0; $j < 5; $j++ ) - { - // Fill each table cell with ## - $table[$i][$j]->content = '##'; - if ( $i === $j ) - { - // On diagonal line set explicit cell format for even/odd - $table[$i][$j]->format = $j % 2 == 0 ? 'evenCell' : 'oddCell'; - } - } - // Set global format for even/odd rows - $table[$i]->format = $i % 2 == 0 ? 'evenRow' : 'oddRow'; - // Set border format for even/odd rows - $table[$i]->borderFormat = $i % 2 == 0 ? 'evenRow' : 'oddRow'; -} - -$table->outputTable(); -echo "\n"; -?> +formats->evenRow->color = 'red'; +$out->formats->evenRow->style = array( 'bold' ); + +$out->formats->oddRow->color = 'blue'; +$out->formats->oddRow->style = array( 'bold' ); + +// Define format schemes for even and odd cells +$out->formats->evenCell->color = 'red'; +$out->formats->evenCell->style = array( 'negative' ); + +$out->formats->oddCell->color = 'blue'; +$out->formats->oddCell->style = array( 'negative' ); + +// Create a new table with a width of 60 chars +$table = new ezcConsoleTable($out, 60); + +// Set global cell content align +$table->options->defaultAlign = ezcConsoleTable::ALIGN_CENTER; + +for ($i = 0; $i < 5; $i ++) { + for ($j = 0; $j < 5; $j++) { + // Fill each table cell with ## + $table[$i][$j]->content = '##'; + if ($i === $j) { + // On diagonal line set explicit cell format for even/odd + $table[$i][$j]->format = $j % 2 == 0 ? 'evenCell' : 'oddCell'; + } + } + // Set global format for even/odd rows + $table[$i]->format = $i % 2 == 0 ? 'evenRow' : 'oddRow'; + // Set border format for even/odd rows + $table[$i]->borderFormat = $i % 2 == 0 ? 'evenRow' : 'oddRow'; +} + +$table->outputTable(); +echo "\n"; diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_autoload.php index 0dc0a532afe76573adec396b64ebf21c0daa99a5..2ca6ec01488e7ca15f0314e2fbd2f8de577ba61b 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_autoload.php @@ -1,20 +1,24 @@ - +formats->info->color = 'blue'; - -$output->outputText( 'Test text in color blue', 'info' ); - -?> +formats->info->color = 'blue'; + +$output->outputText('Test text in color blue', 'info'); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_02.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_02.php index 5ad8167ecc350829acfeb4e1768e6897a25e3d11..040ca874b993ff3691edc8fc7661ee3085fc74f6 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_02.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_02.php @@ -1,25 +1,23 @@ -formats->info->color = 'blue'; - -$output->formats->error->color = 'red'; -$output->formats->error->style = array( 'bold' ); - -$output->formats->fatal->color = 'red'; -$output->formats->fatal->style = array( 'bold', 'underlined' ); -$output->formats->fatal->bgcolor = 'black'; - -$output->outputText( 'This is some standard text ' ); -$output->outputText( 'including some error', 'error' ); -$output->outputText( ' wrapped in standard text.' ); -$output->outputText( "\n" ); - -$output->outputLine( 'This is a fatal error message.', 'fatal' ); - -$output->outputText( 'Test' ); - -?> +formats->info->color = 'blue'; + +$output->formats->error->color = 'red'; +$output->formats->error->style = array( 'bold' ); + +$output->formats->fatal->color = 'red'; +$output->formats->fatal->style = array( 'bold', 'underlined' ); +$output->formats->fatal->bgcolor = 'black'; + +$output->outputText('This is some standard text '); +$output->outputText('including some error', 'error'); +$output->outputText(' wrapped in standard text.'); +$output->outputText("\n"); + +$output->outputLine('This is a fatal error message.', 'fatal'); + +$output->outputText('Test'); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_03.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_03.php index 172243ef2e1a58594b38672f769a757b0bbf460a..eb7112837d9a0c590594e071f901f4fb3a8c7de8 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_03.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_03.php @@ -1,27 +1,25 @@ -formats->info->color = 'blue'; -$output->formats->info->style = array( 'bold' ); - -$output->setOptions( - array( - 'autobreak' => 78, - 'verbosityLevel' => 3 - ) -); - -$output->outputLine( 'This is a very very long info text. It has so much information in '. - 'it, that it will definitly not fit into 1 line. Therefore, '. - 'ezcConsoleOutput will automatically wrap the line for us.', 'info' ); - -$output->outputLine(); - -$output->outputLine( 'This verbose information will currently not be displayed.', 'info', 10 ); - -$output->outputLine( 'But this verbose information will be displayed.', 'info', 2 ); - -?> +formats->info->color = 'blue'; +$output->formats->info->style = array( 'bold' ); + +$output->setOptions( + array( + 'autobreak' => 78, + 'verbosityLevel' => 3 + ) +); + +$output->outputLine('This is a very very long info text. It has so much information in '. + 'it, that it will definitly not fit into 1 line. Therefore, '. + 'ezcConsoleOutput will automatically wrap the line for us.', 'info'); + +$output->outputLine(); + +$output->outputLine('This verbose information will currently not be displayed.', 'info', 10); + +$output->outputLine('But this verbose information will be displayed.', 'info', 2); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_04.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_04.php index 2f1f9b3ad44ebc0ffcc8bac23cab56eb65f73d6f..d39775e33a151e757488982bd01dd7d5cfa5accb 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_04.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_04.php @@ -1,32 +1,24 @@ -registerOption( - new ezcConsoleOption( - 'h', - 'help' - ) -); - -try -{ - $input->process(); -} -catch ( ezcConsoleOptionException $e ) -{ - die( $e->getMessage() ); -} - -if ( $helpOption->value !== false ) -{ - echo "Help requested."; -} -else -{ - echo "No help requested."; -} - -?> +registerOption( + new ezcConsoleOption( + 'h', + 'help' + ) +); + +try { + $input->process(); +} catch (ezcConsoleOptionException $e) { + die($e->getMessage()); +} + +if ($helpOption->value !== false) { + echo "Help requested."; +} else { + echo "No help requested."; +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_05.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_05.php index b009da6c1ebeb4f7530d1de0499d1658a1299bf8..5de354016f9f7395586dc9ac01a49b30e72c10b8 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_05.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_05.php @@ -1,55 +1,46 @@ -registerOption( new ezcConsoleOption( 'h', 'help' ) ); - -$inputOption = $input->registerOption( - new ezcConsoleOption( - 'i', - 'input', - ezcConsoleInput::TYPE_STRING - ) -); - -$outputOption = $input->registerOption( - new ezcConsoleOption( - 'o', - 'output' - ) -); -$outputOption->type = ezcConsoleInput::TYPE_STRING; - -$inputOption->addDependency( - new ezcConsoleOptionRule( $outputOption ) -); -$outputOption->addDependency( - new ezcConsoleOptionRule( $inputOption ) -); - -try -{ - $input->process(); -} -catch ( ezcConsoleOptionException $e ) -{ - die( $e->getMessage() ); -} - -if ( $helpOption->value === true ) -{ - echo $input->getSynopsis() . "\n"; - foreach ( $input->getOptions() as $option ) - { - echo "-{$option->short}/{$option->long}: {$option->shorthelp}\n"; - } -} -elseif ( $outputOption->value !== false ) -{ - echo "Input: {$inputOption->value}, Output: {$outputOption->value}\n"; - echo "Arguments: " . implode( ", ", $input->getArguments() ) . "\n"; -} - -?> +registerOption(new ezcConsoleOption('h', 'help')); + +$inputOption = $input->registerOption( + new ezcConsoleOption( + 'i', + 'input', + ezcConsoleInput::TYPE_STRING + ) +); + +$outputOption = $input->registerOption( + new ezcConsoleOption( + 'o', + 'output' + ) +); +$outputOption->type = ezcConsoleInput::TYPE_STRING; + +$inputOption->addDependency( + new ezcConsoleOptionRule($outputOption) +); +$outputOption->addDependency( + new ezcConsoleOptionRule($inputOption) +); + +try { + $input->process(); +} catch (ezcConsoleOptionException $e) { + die($e->getMessage()); +} + +if ($helpOption->value === true) { + echo $input->getSynopsis() . "\n"; + foreach ($input->getOptions() as $option) { + echo "-{$option->short}/{$option->long}: {$option->shorthelp}\n"; + } +} elseif ($outputOption->value !== false) { + echo "Input: {$inputOption->value}, Output: {$outputOption->value}\n"; + echo "Arguments: " . implode(", ", $input->getArguments()) . "\n"; +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_06.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_06.php index 178b3edaefcaa558887df226cd62db9c470a218a..2caacb8f696627b70fe8dd8e437da66ed378bd9d 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_06.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_06.php @@ -1,19 +1,16 @@ -advance(); - usleep( mt_rand( 2000, 200000 ) ); -} - -$bar->finish(); - -$output->outputLine(); - -?> +advance(); + usleep(mt_rand(2000, 200000)); +} + +$bar->finish(); + +$output->outputLine(); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_07.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_07.php index 4296cf1cf16506173df94c13d76a460cb40eaefd..f61fc84193bc4e53daa8d4dc15d2cdb7ec018bc2 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_07.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_07.php @@ -1,29 +1,26 @@ -formats->bar->color = 'blue'; -$output->formats->bar->style = array( 'bold' ); - -$options = array( - 'emptyChar' => ' ', - 'barChar' => '-', - 'formatString' => '%fraction%% <' . $output->formatText( '%bar%', 'bar' ) . '> Uploaded %act% / %max% kb', - 'redrawFrequency' => 50, -); - -$bar = new ezcConsoleProgressbar( $output, 1024, $options ); - -for ( $i = 0; $i < 1024; $i++ ) -{ - $bar->advance(); - usleep( mt_rand( 200, 2000 ) ); -} - -$bar->finish(); - -$output->outputLine(); - -?> +formats->bar->color = 'blue'; +$output->formats->bar->style = array( 'bold' ); + +$options = array( + 'emptyChar' => ' ', + 'barChar' => '-', + 'formatString' => '%fraction%% <' . $output->formatText('%bar%', 'bar') . '> Uploaded %act% / %max% kb', + 'redrawFrequency' => 50, +); + +$bar = new ezcConsoleProgressbar($output, 1024, $options); + +for ($i = 0; $i < 1024; $i++) { + $bar->advance(); + usleep(mt_rand(200, 2000)); +} + +$bar->finish(); + +$output->outputLine(); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_08.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_08.php index a87a0210636345ad6e1433786ff8d42386365383..ee011c657b920e2977962ce469350e7c9e8f7d53 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_08.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_08.php @@ -1,27 +1,24 @@ -formats->success->color = 'green'; -$output->formats->failure->color = 'red'; - -$options = array( - 'successChar' => $output->formatText( '+', 'success' ), - 'failureChar' => $output->formatText( '-', 'failure' ), -); - -$status = new ezcConsoleStatusbar( $output, $options ); - -for ( $i = 0; $i < 120; $i++ ) -{ - $nextStatus = ( bool )mt_rand( 0,1 ); - $status->add( $nextStatus ); - usleep( mt_rand( 200, 2000 ) ); -} - -$output->outputLine(); -$output->outputLine( 'Successes: ' . $status->getSuccessCount() . ', Failures: ' . $status->getFailureCount() ); - -?> +formats->success->color = 'green'; +$output->formats->failure->color = 'red'; + +$options = array( + 'successChar' => $output->formatText('+', 'success'), + 'failureChar' => $output->formatText('-', 'failure'), +); + +$status = new ezcConsoleStatusbar($output, $options); + +for ($i = 0; $i < 120; $i++) { + $nextStatus = ( bool )mt_rand(0, 1); + $status->add($nextStatus); + usleep(mt_rand(200, 2000)); +} + +$output->outputLine(); +$output->outputLine('Successes: ' . $status->getSuccessCount() . ', Failures: ' . $status->getFailureCount()); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_09.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_09.php index 5c29125a61271b8404b81482afd39e0393056e45..dd010915ace4d0072a2495b2af6810e7e0821520 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_09.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_09.php @@ -1,43 +1,38 @@ -formats->headBorder->color = 'blue'; -$output->formats->normalBorder->color = 'gray'; - -$output->formats->headContent->color = 'blue'; -$output->formats->headContent->style = array( 'bold' ); - -$table = new ezcConsoleTable( $output, 78 ); - -$table->options->defaultBorderFormat = 'normalBorder'; - -$table[0]->borderFormat = 'headBorder'; -$table[0]->format = 'headContent'; -$table[0]->align = ezcConsoleTable::ALIGN_CENTER; - -foreach ( $data as $row => $cells ) -{ - foreach ( $cells as $cell ) - { - $table[$row][]->content = $cell; - } -} - -$output->outputLine( 'eZ components team:' ); -$table->outputTable(); -$output->outputLine(); - - -?> +formats->headBorder->color = 'blue'; +$output->formats->normalBorder->color = 'gray'; + +$output->formats->headContent->color = 'blue'; +$output->formats->headContent->style = array( 'bold' ); + +$table = new ezcConsoleTable($output, 78); + +$table->options->defaultBorderFormat = 'normalBorder'; + +$table[0]->borderFormat = 'headBorder'; +$table[0]->format = 'headContent'; +$table[0]->align = ezcConsoleTable::ALIGN_CENTER; + +foreach ($data as $row => $cells) { + foreach ($cells as $cell) { + $table[$row][]->content = $cell; + } +} + +$output->outputLine('eZ components team:'); +$table->outputTable(); +$output->outputLine(); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_10.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_10.php index 1494fd33ffcb9316fd60f30ee7c6762c6a6ad0af..d8e79e9dd57f9b255dbac8ad3d5ed7b3b17ff5cb 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_10.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_10.php @@ -1,38 +1,33 @@ -formats->blue->color = 'blue'; -$output->formats->blue->style = array( 'bold' ); -$output->formats->red->color = 'red'; -$output->formats->red->style = array( 'bold' ); -$output->formats->green->color = 'green'; -$output->formats->green->style = array( 'bold' ); - -$colors = array( 'red', 'blue', 'green' ); -$aligns = array( ezcConsoleTable::ALIGN_LEFT, ezcConsoleTable::ALIGN_CENTER, ezcConsoleTable::ALIGN_RIGHT ); - -$table = new ezcConsoleTable( $output, 78 ); - -$table->options->corner = ' '; -$table->options->lineHorizontal = ' '; -$table->options->lineVertical = ' '; -$table->options->widthType = ezcConsoleTable::WIDTH_FIXED; - -for ( $i = 0; $i < 10; $i++ ) -{ - for ( $j = 0; $j < 10; $j++ ) - { - $table[$i][$j]->content = '*'; - $table[$i][$j]->format = $colors[array_rand( $colors )]; - $table[$i][$j]->align = $aligns[array_rand( $aligns )]; - } -} - -$table->outputTable(); -$output->outputLine(); - - -?> +formats->blue->color = 'blue'; +$output->formats->blue->style = array( 'bold' ); +$output->formats->red->color = 'red'; +$output->formats->red->style = array( 'bold' ); +$output->formats->green->color = 'green'; +$output->formats->green->style = array( 'bold' ); + +$colors = array( 'red', 'blue', 'green' ); +$aligns = array( ezcConsoleTable::ALIGN_LEFT, ezcConsoleTable::ALIGN_CENTER, ezcConsoleTable::ALIGN_RIGHT ); + +$table = new ezcConsoleTable($output, 78); + +$table->options->corner = ' '; +$table->options->lineHorizontal = ' '; +$table->options->lineVertical = ' '; +$table->options->widthType = ezcConsoleTable::WIDTH_FIXED; + +for ($i = 0; $i < 10; $i++) { + for ($j = 0; $j < 10; $j++) { + $table[$i][$j]->content = '*'; + $table[$i][$j]->format = $colors[array_rand($colors)]; + $table[$i][$j]->align = $aligns[array_rand($aligns)]; + } +} + +$table->outputTable(); +$output->outputLine(); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_11.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_11.php index c8ac7c52a72e77fdc592d4f5b3b4bff9b9ea3dc3..c1586a26006c7b68145bb1af1d82ba7fd19dfc4e 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_11.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/docs/tutorial_example_11.php @@ -1,18 +1,15 @@ -addEntry( 'ACTION', "Performed action #{$i}." ); -} - -$out->outputLine(); - -?> +addEntry('ACTION', "Performed action #{$i}."); +} + +$out->outputLine(); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/console_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/console_autoload.php index 74c31f7792368aa7b87728b3f98a605d1bdfdfcd..585372cd645cda84063ca34d870a4f72b77ce62c 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/console_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/console_autoload.php @@ -1,51 +1,49 @@ - 'ConsoleTools/output.php', - 'ezcConsoleOutputOptions' => 'ConsoleTools/options/output.php', - 'ezcConsoleOutputFormats' => 'ConsoleTools/structs/output_formats.php', - 'ezcConsoleOutputFormat' => 'ConsoleTools/structs/output_format.php', - 'ezcConsoleInput' => 'ConsoleTools/input.php', - 'ezcConsoleOption' => 'ConsoleTools/input/option.php', - 'ezcConsoleOptionRule' => 'ConsoleTools/structs/option_rule.php', - 'ezcConsoleTable' => 'ConsoleTools/table.php', - 'ezcConsoleTableRow' => 'ConsoleTools/table/row.php', - 'ezcConsoleTableCell' => 'ConsoleTools/table/cell.php', - 'ezcConsoleTableOptions' => 'ConsoleTools/options/table.php', - 'ezcConsoleProgressbar' => 'ConsoleTools/progressbar.php', - 'ezcConsoleProgressbarOptions' => 'ConsoleTools/options/progressbar.php', - 'ezcConsoleProgressMonitor' => 'ConsoleTools/progressmonitor.php', - 'ezcConsoleProgressMonitorOptions' => 'ConsoleTools/options/progressmonitor.php', - 'ezcConsoleStatusbar' => 'ConsoleTools/statusbar.php', - 'ezcConsoleStatusbarOptions' => 'ConsoleTools/options/statusbar.php', - - 'ezcConsoleException' => 'ConsoleTools/exceptions/exception.php', - 'ezcConsoleNoPositionStoredException' => 'ConsoleTools/exceptions/no_position_stored.php', - - 'ezcConsoleOptionAlreadyRegisteredException' => 'ConsoleTools/exceptions/option_already_registered.php', - 'ezcConsoleOptionNoAliasException' => 'ConsoleTools/exceptions/option_no_alias.php', - 'ezcConsoleOptionStringNotWellformedException' => 'ConsoleTools/exceptions/option_string_not_wellformed.php', - 'ezcConsoleInvalidOptionNameException' => 'ConsoleTools/exceptions/invalid_option_name.php', - - 'ezcConsoleOptionException' => 'ConsoleTools/exceptions/option.php', - - 'ezcConsoleOptionArgumentsViolationException' => 'ConsoleTools/exceptions/option_arguments_violation.php', - 'ezcConsoleOptionDependencyViolationException' => 'ConsoleTools/exceptions/option_dependency_violation.php', - 'ezcConsoleOptionExclusionViolationException' => 'ConsoleTools/exceptions/option_exclusion_violation.php', - 'ezcConsoleOptionMandatoryViolationException' => 'ConsoleTools/exceptions/option_mandatory_violation.php', - 'ezcConsoleOptionTypeViolationException' => 'ConsoleTools/exceptions/option_type_violation.php', - 'ezcConsoleOptionMissingValueException' => 'ConsoleTools/exceptions/option_missing_value.php', - 'ezcConsoleOptionNotExistsException' => 'ConsoleTools/exceptions/option_not_exists.php', - 'ezcConsoleOptionTooManyValuesException' => 'ConsoleTools/exceptions/option_too_many_values.php', -); - -?> + 'ConsoleTools/output.php', + 'ezcConsoleOutputOptions' => 'ConsoleTools/options/output.php', + 'ezcConsoleOutputFormats' => 'ConsoleTools/structs/output_formats.php', + 'ezcConsoleOutputFormat' => 'ConsoleTools/structs/output_format.php', + 'ezcConsoleInput' => 'ConsoleTools/input.php', + 'ezcConsoleOption' => 'ConsoleTools/input/option.php', + 'ezcConsoleOptionRule' => 'ConsoleTools/structs/option_rule.php', + 'ezcConsoleTable' => 'ConsoleTools/table.php', + 'ezcConsoleTableRow' => 'ConsoleTools/table/row.php', + 'ezcConsoleTableCell' => 'ConsoleTools/table/cell.php', + 'ezcConsoleTableOptions' => 'ConsoleTools/options/table.php', + 'ezcConsoleProgressbar' => 'ConsoleTools/progressbar.php', + 'ezcConsoleProgressbarOptions' => 'ConsoleTools/options/progressbar.php', + 'ezcConsoleProgressMonitor' => 'ConsoleTools/progressmonitor.php', + 'ezcConsoleProgressMonitorOptions' => 'ConsoleTools/options/progressmonitor.php', + 'ezcConsoleStatusbar' => 'ConsoleTools/statusbar.php', + 'ezcConsoleStatusbarOptions' => 'ConsoleTools/options/statusbar.php', + + 'ezcConsoleException' => 'ConsoleTools/exceptions/exception.php', + 'ezcConsoleNoPositionStoredException' => 'ConsoleTools/exceptions/no_position_stored.php', + + 'ezcConsoleOptionAlreadyRegisteredException' => 'ConsoleTools/exceptions/option_already_registered.php', + 'ezcConsoleOptionNoAliasException' => 'ConsoleTools/exceptions/option_no_alias.php', + 'ezcConsoleOptionStringNotWellformedException' => 'ConsoleTools/exceptions/option_string_not_wellformed.php', + 'ezcConsoleInvalidOptionNameException' => 'ConsoleTools/exceptions/invalid_option_name.php', + + 'ezcConsoleOptionException' => 'ConsoleTools/exceptions/option.php', + + 'ezcConsoleOptionArgumentsViolationException' => 'ConsoleTools/exceptions/option_arguments_violation.php', + 'ezcConsoleOptionDependencyViolationException' => 'ConsoleTools/exceptions/option_dependency_violation.php', + 'ezcConsoleOptionExclusionViolationException' => 'ConsoleTools/exceptions/option_exclusion_violation.php', + 'ezcConsoleOptionMandatoryViolationException' => 'ConsoleTools/exceptions/option_mandatory_violation.php', + 'ezcConsoleOptionTypeViolationException' => 'ConsoleTools/exceptions/option_type_violation.php', + 'ezcConsoleOptionMissingValueException' => 'ConsoleTools/exceptions/option_missing_value.php', + 'ezcConsoleOptionNotExistsException' => 'ConsoleTools/exceptions/option_not_exists.php', + 'ezcConsoleOptionTooManyValuesException' => 'ConsoleTools/exceptions/option_too_many_values.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/exception.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/exception.php index 745ff72ed48fee3936dde89183d5b0ae5bd0a1f1..9757b2743bb44d2fc880e06083820c8448857114 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/exception.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/exception.php @@ -1,20 +1,19 @@ - + is invalid." ); - } -} - -?> + is invalid."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/no_position_stored.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/no_position_stored.php index 2f09752eeac20478f63042cabdada1d68bdb838c..4e651794a56f8050efe977686042620da866c3d2 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/no_position_stored.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/no_position_stored.php @@ -1,25 +1,23 @@ - + + is already registered." ); - } -} - -?> + is already registered."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_arguments_violation.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_arguments_violation.php index 243df7f094c5f67f61a06b2b1f71a74547e5cd6a..07bbe8433cb6674ec3dcb021a9c987acf93a7aeb 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_arguments_violation.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_arguments_violation.php @@ -1,26 +1,24 @@ -long}> excludes the usage of arguments, but arguments have been submitted." ); - } -} - -?> +long}> excludes the usage of arguments, but arguments have been submitted."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_dependency_violation.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_dependency_violation.php index a8079eae1475f3a925d23cbcbc40dbf9f40e477a..59162c5791ab92fa990764742c8aca48e55c39ea 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_dependency_violation.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_dependency_violation.php @@ -1,31 +1,29 @@ -long}> depends on the option <{$dependantOption->long}> "; - if ( $valueRange !== null ) - { - $message .= " to have a value in <{$valueRange}> "; - } - $message .= "but this one was not submitted."; - parent::__construct( $message ); - } -} -?> +long}> depends on the option <{$dependantOption->long}> "; + if ($valueRange !== null) { + $message .= " to have a value in <{$valueRange}> "; + } + $message .= "but this one was not submitted."; + parent::__construct($message); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_exclusion_violation.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_exclusion_violation.php index 6c7833a6ec579312cd7bc5499a529765a64d4f98..c6e55e8d89781843e095d75abcb37ff885abbb92 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_exclusion_violation.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_exclusion_violation.php @@ -1,31 +1,29 @@ -long}> excludes the option <{$excludedOption->long}>" ; - if ( $valueRange !== null ) - { - $message .= "to have a value in <{$valueRange}> "; - } - $message .= "but this one was submitted."; - parent::__construct( $message ); - } -} -?> +long}> excludes the option <{$excludedOption->long}>" ; + if ($valueRange !== null) { + $message .= "to have a value in <{$valueRange}> "; + } + $message .= "but this one was submitted."; + parent::__construct($message); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_mandatory_violation.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_mandatory_violation.php index aadb6f79f48f4b283951dc916216592a0cf285fb..e82c282698620457c3f763edad10b9d2d21e9e5c 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_mandatory_violation.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_mandatory_violation.php @@ -1,26 +1,24 @@ -long}> is mandatory but was not submitted." ); - } -} - -?> +long}> is mandatory but was not submitted."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_missing_value.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_missing_value.php index 4fef794d4da9e694af4cc7064cdfcb8de9276e15..6c00afa889fd149d3dcd2dc3cdff416417d32d80 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_missing_value.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_missing_value.php @@ -1,26 +1,24 @@ -long}> expects a value, but none was submitted." ); - } -} - -?> +long}> expects a value, but none was submitted."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_no_alias.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_no_alias.php index b4fe24c87cf581a3fedea63f87924fda767f707b..d0e933e23084da3bf5071700996a76ff7b911759 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_no_alias.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_no_alias.php @@ -1,25 +1,23 @@ - refers to a real parameter, not to an alias." ); - } -} - -?> + refers to a real parameter, not to an alias."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_not_exists.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_not_exists.php index 5bf4d10080ab037ee86a626b0c4204776822f3b0..4766978bc1f685dea4a5ea9762efd41e329b1d51 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_not_exists.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_not_exists.php @@ -1,25 +1,24 @@ - is not registered." ); - } -} -?> + is not registered."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_string_not_wellformed.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_string_not_wellformed.php index 2c216b9f41c545e2b1966d2df20126afe61571ea..a643f419335c783e4e723aabb4c361d313c746b1 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_string_not_wellformed.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_string_not_wellformed.php @@ -1,25 +1,23 @@ - +long}> expects a single value, but multiple were submitted." ); - } -} - -?> +long}> expects a single value, but multiple were submitted."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_type_violation.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_type_violation.php index 028028a0aebd6e0a08bb2fcbf81c89ea961bdaec..2b667a04e3d31c3f6978b3f0da04462922f79dcc 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_type_violation.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/exceptions/option_type_violation.php @@ -1,38 +1,36 @@ -type ) - { - case ezcConsoleInput::TYPE_NONE: - $typeName = 'none'; - break; - case ezcConsoleInput::TYPE_INT: - $typeName = 'int'; - break; - case ezcConsoleInput::TYPE_STRING: - $typeName = 'string'; - break; - } - parent::__construct( "The option <{$option->long}> expects a value of type <{$typeName}>, but received the value <{$value}>." ); - } -} -?> +type) { + case ezcConsoleInput::TYPE_NONE: + $typeName = 'none'; + break; + case ezcConsoleInput::TYPE_INT: + $typeName = 'int'; + break; + case ezcConsoleInput::TYPE_STRING: + $typeName = 'string'; + break; + } + parent::__construct("The option <{$option->long}> expects a value of type <{$typeName}>, but received the value <{$value}>."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/input.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/input.php index 69d2e88112ecbeade35f7e9fe47d2cf49b91bc17..b4a62be1d1797e4e1df38d51732eedb385c7e62a 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/input.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/input.php @@ -1,1038 +1,951 @@ - - * $optionHandler = new ezcConsoleInput(); - * - * // Register simple parameter -h/--help - * $optionHandler->registerOption( new ezcConsoleOption( 'h', 'help' ) ); - * - * // Register complex parameter -f/--file - * $file = new ezcConsoleOption( - * 'f', - * 'file', - * ezcConsoleInput::TYPE_STRING, - * null, - * false, - * 'Process a file.', - * 'Processes a single file.' - * ); - * $optionHandler->registerOption( $file ); - * - * // Manipulate parameter -f/--file after registration - * $file->multiple = true; - * - * // Register another complex parameter that depends on -f and excludes -h - * $dir = new ezcConsoleOption( - * 'd', - * 'dir', - * ezcConsoleInput::TYPE_STRING, - * null, - * true, - * 'Process a directory.', - * 'Processes a complete directory.', - * array( new ezcConsoleOptionRule( $optionHandler->getOption( 'f' ) ) ), - * array( new ezcConsoleOptionRule( $optionHandler->getOption( 'h' ) ) ) - * ); - * $optionHandler->registerOption( $dir ); - * - * // Register an alias for this parameter - * $optionHandler->registerAlias( 'e', 'extended-dir', $dir ); - * - * // Process registered parameters and handle errors - * try - * { - * $optionHandler->process( array( 'example_input.php', '-h' ) ); - * } - * catch ( ezcConsoleOptionException $e ) - * { - * echo $e->getMessage(); - * exit( 1 ); - * } - * - * // Process a single parameter - * $file = $optionHandler->getOption( 'f' ); - * if ( $file->value === false ) - * { - * echo "Parameter -{$file->short}/--{$file->long} was not submitted.\n"; - * } - * elseif ( $file->value === true ) - * { - * echo "Parameter -{$file->short}/--{$file->long} was submitted without value.\n"; - * } - * else - * { - * echo "Parameter -{$file->short}/--{$file->long} was submitted with value <".var_export($file->value, true).">.\n"; - * } - * - * // Process all parameters at once: - * foreach ( $optionHandler->getOptionValues() as $paramShort => $val ) - * { - * switch ( true ) - * { - * case $val === false: - * echo "Parameter $paramShort was not submitted.\n"; - * break; - * case $val === true: - * echo "Parameter $paramShort was submitted without a value.\n"; - * break; - * case is_array( $val ): - * echo "Parameter $paramShort was submitted multiple times with value: <".implode(', ', $val).">.\n"; - * break; - * default: - * echo "Parameter $paramShort was submitted with value: <$val>.\n"; - * break; - * } - * } - * - * - * @package ConsoleTools - * @version 1.1.3 - * @mainclass - */ -class ezcConsoleInput -{ - /** - * Option does not carry a value. - */ - const TYPE_NONE = 1; - - /** - * Option takes an integer value. - */ - const TYPE_INT = 2; - - /** - * Option takes a string value. - */ - const TYPE_STRING = 3; - - /** - * Array of option definitions, indexed by number. - * - * This array stores the ezcConsoleOption objects representing - * the options. - * - * For lookup of an option after its short or long values the attributes - * @link ezcConsoleInput::$optionShort - * @link ezcConsoleInput::$optionLong - * are used. - * - * @var array(int=>array) - */ - private $options = array(); - - /** - * Short option names. - * - * Each references a key in {@link ezcConsoleInput::$options}. - * - * @var array(string=>int) - */ - private $optionShort = array(); - - /** - * Long option names. - * - * Each references a key in {@link ezcConsoleInput::$options}. - * - * @var array(string=>int) - */ - private $optionLong = array(); - - /** - * Arguments, if submitted, are stored here. - * - * @var array(string) - */ - private $arguments = array(); - - - /** - * Indicates if an option was submitted, that has the isHelpOption flag set. - * - * @var bool - */ - private $helpOptionSet = false; - - /** - * Creates an input handler. - */ - public function __construct() - { - } - - /** - * Registers the new option $option. - * - * This method adds the new option $option to your option collection. If - * already an option with the assigned short or long value exists, an - * exception will be thrown. - * - * @see ezcConsoleInput::unregisterOption() - * - * @param ezcConsoleOption $option - * - * @return ezcConsoleOption The recently registered option. - */ - public function registerOption( ezcConsoleOption $option ) - { - foreach ( $this->optionShort as $short => $ref ) - { - if ( $short === $option->short ) - { - throw new ezcConsoleOptionAlreadyRegisteredException( $short ); - } - } - foreach ( $this->optionLong as $long => $ref ) - { - if ( $long === $option->long ) - { - throw new ezcConsoleOptionAlreadyRegisteredException( $long ); - } - } - $this->options[] = $option; - $this->optionLong[$option->long] = $option; - if ( $option->short !== "" ) - { - $this->optionShort[$option->short] = $option; - } - return $option; - } - - /** - * Registers an alias for an option. - * - * Registers a new alias for an existing option. Aliases can - * be used as if they were a normal option. - * - * The alias is registered with the short option name $short and the - * long option name $long. The alias references to the existing - * option $option. - * - * @see ezcConsoleInput::unregisterAlias() - * - * @param string $short - * @param string $long - * @param ezcConsoleOption $option - * - * - * @throws ezcConsoleOptionNotExistsException - * If the referenced option is not registered. - * @throws ezcConsoleOptionAlreadyRegisteredException - * If another option/alias has taken the provided short or long name. - * @return void - */ - public function registerAlias( $short, $long, ezcConsoleOption $option ) - { - $short = $short; - $long = $long; - if ( !isset( $this->optionShort[$option->short] ) || !isset( $this->optionLong[$option->long] ) ) - { - throw new ezcConsoleOptionNotExistsException( $option->long ); - } - if ( isset( $this->optionShort[$short] ) || isset( $optionLong[$long] ) ) - { - throw new ezcConsoleOptionAlreadyRegisteredException( isset( $this->optionShort[$short] ) ? $this->optionShort[$short] : $this->optionLong[$long] ); - } - $this->shortParam[$short] = $option; - $this->longParam[$long] = $option; - } - - /** - * Registers options according to a string specification. - * - * Accepts a string to define parameters and registers all parameters as - * options accordingly. String definition, specified in $optionDef, looks - * like this: - * - * - * [s:|size:][u:|user:][a:|all:] - * - * - * This string registers 3 parameters: - * -s / --size - * -u / --user - * -a / --all - * - * @param string $optionDef - * @return void - * - * @throws ezcConsoleOptionStringNotWellformedException - * If provided string does not have the correct format. - */ - public function registerOptionString( $optionDef ) - { - $regex = '/\[([a-z0-9-]+)([:?*+])?([^|]*)\|([a-z0-9-]+)([:?*+])?\]/'; - if ( preg_match_all( $regex, $optionDef, $matches ) ) - { - foreach ( $matches[1] as $id => $short ) - { - $option = null; - if ( empty( $matches[4][$id] ) ) - { - throw new ezcConsoleOptionStringNotWellformedException( "Missing long parameter name for short parameter <-{$short}>" ); - } - $option = new ezcConsoleOption( $short, $matches[4][$id] ); - if ( !empty( $matches[2][$id] ) || !empty( $matches[5][$id] ) ) - { - switch ( !empty( $matches[2][$id] ) ? $matches[2][$id] : $matches[5][$id] ) - { - case '*': - // Allows 0 or more occurances - $option->multiple = true; - break; - case '+': - // Allows 1 or more occurances - $option->multiple = true; - $option->type = self::TYPE_STRING; - break; - case '?': - $option->type = self::TYPE_STRING; - $option->default = ''; - break; - default: - break; - } - } - if ( !empty( $matches[3][$id] ) ) - { - $option->default = $matches[3][$id]; - } - $this->registerOption( $option ); - } - } - - } - - /** - * Removes an option. - * - * This function removes an option. All dependencies to that - * specific option are removed completely from every other registered - * option. - * - * @see ezcConsoleInput::registerOption() - * - * @param ezcConsoleOption $option The option object to unregister. - * - * @throws ezcConsoleOptionNotExistsException - * If requesting a not registered option. - * @return void - */ - public function unregisterOption( ezcConsoleOption $option ) - { - $found = false; - foreach ( $this->options as $id => $existParam ) - { - if ( $existParam === $option ) - { - $found = true; - unset( $this->options[$id] ); - continue; - } - $existParam->removeAllExclusions( $option ); - $existParam->removeAllDependencies( $option ); - } - if ( $found === false ) - { - throw new ezcConsoleOptionNotExistsException( $option->long ); - } - foreach ( $this->optionLong as $name => $existParam ) - { - if ( $existParam === $option ) - { - unset( $this->optionLong[$name] ); - } - } - foreach ( $this->optionShort as $name => $existParam ) - { - if ( $existParam === $option ) - { - unset( $this->optionShort[$name] ); - } - } - } - - /** - * Removes an alias to an option. - * - * This function removes an alias with the short name $short and long - * name $long. - * - * @see ezcConsoleInput::registerAlias() - * - * @throws ezcConsoleOptionNoAliasException - * If the requested short/long name belongs to a real parameter instead. - * - * @param string $short - * @param string $long - * @return void - * - * @todo Check if $short and $long refer to the same option! - */ - public function unregisterAlias( $short, $long ) - { - $short = $short; - $long = $long; - foreach ( $this->options as $id => $option ) - { - if ( $option->short === $short ) - { - throw new ezcConsoleOptionNoAliasException( $short ); - } - if ( $option->long === $long ) - { - throw new ezcConsoleOptionNoAliasException( $long ); - } - } - if ( isset( $this->optionShort[$short] ) ) - { - unset( $this->optionShort[$short] ); - } - if ( isset( $this->optionLong[$short] ) ) - { - unset( $this->optionLong[$long] ); - } - } - - /** - * Returns the definition object for the option with the name $name. - * - * This method receives the long or short name of an option and - * returns the ezcConsoleOption object. - * - * @param string $name Short or long name of the option (without - or --). - * @return ezcConsoleOption - * - * @throws ezcConsoleOptionNotExistsException - * If requesting a not registered parameter. - */ - public function getOption( $name ) - { - $name = $name; - if ( isset( $this->optionShort[$name] ) ) - { - return $this->optionShort[$name]; - } - if ( isset( $this->optionLong[$name] ) ) - { - return $this->optionLong[$name]; - } - throw new ezcConsoleOptionNotExistsException( $name ); - } - - /** - * Process the input parameters. - * - * Actually process the input options and arguments according to the actual - * settings. - * - * Per default this method uses $argc and $argv for processing. You can - * override this setting with your own input, if necessary, using the - * parameters of this method. (Attention, first argument is always the pro - * gram name itself!) - * - * All exceptions thrown by this method contain an additional attribute "option" - * which specifies the parameter on which the error occurred. - * - * @param array(int=>string) $args The arguments - * @return void - * - * @throws ezcConsoleOptionNotExistsException - * If an option that was submitted does not exist. - * @throws ezcConsoleOptionDependencyViolationException - * If a dependency rule was violated. - * @throws ezcConsoleOptionExclusionViolationException - * If an exclusion rule was violated. - * @throws ezcConsoleOptionTypeViolationException - * If the type of a submitted value violates the options type rule. - * @throws ezcConsoleOptionArgumentsViolationException - * If arguments are passed although a parameter disallowed them. - * - * @see ezcConsoleOptionException - */ - public function process( array $args = null ) - { - if ( !isset( $args ) ) - { - $args = isset( $argv ) ? $argv : isset( $_SERVER['argv'] ) ? $_SERVER['argv'] : array(); - } - $i = 1; - while ( $i < count( $args ) ) - { - // Equalize parameter handling (long params with =) - if ( substr( $args[$i], 0, 2 ) == '--' ) - { - $this->preprocessLongOption( $args, $i ); - } - // Check for parameter - if ( substr( $args[$i], 0, 1) === '-' && $this->hasOption( preg_replace( '/^-*/', '', $args[$i] ) ) !== false ) - { - $this->processOptions( $args, $i ); - } - // Looks like parameter, but is not available?? - elseif ( substr( $args[$i], 0, 1) === '-' && trim( $args[$i] ) !== '--' ) - { - throw new ezcConsoleOptionNotExistsException( $args[$i] ); - } - // Must be the arguments - else - { - $args[$i] == '--' ? ++$i : $i; - $this->processArguments( $args, $i ); - break; - } - } - $this->checkRules(); - } - - /** - * Returns true if an option with the given name exists, otherwise false. - * - * Checks if an option with the given name is registered. - * - * @param string $name Short or long name of the option. - * @return bool True if option exists, otherwise false. - */ - public function hasOption( $name ) - { - try - { - $param = $this->getOption( $name ); - } - catch ( ezcConsoleOptionNotExistsException $e ) - { - return false; - } - return true; - } - - /** - * Returns an array of all registered options. - * - * Returns an array of all registered options in the following format: - * - * array( - * 0 => ezcConsoleOption, - * 1 => ezcConsoleOption, - * 2 => ezcConsoleOption, - * ... - * ); - * - * - * @return array(string=>ezcConsoleOption) Registered options. - */ - public function getOptions() - { - return $this->options; - } - - /** - * Returns the values of all submitted options. - * - * Returns an array of all values submitted to the options. The array is - * indexed by the parameters short name (excluding the '-' prefix). The array - * does not contain any parameter, which value is 'false' (meaning: the - * parameter was not submitted). - * - * @return array(string=>mixed) - */ - public function getOptionValues() - { - $res = array(); - foreach ( $this->options as $param ) - { - if ( $param->value !== false ) - { - $res[$param->short] = $param->value; - } - } - return $res; - } - - /** - * Returns arguments provided to the program. - * - * This method returns all arguments provided to a program in an - * int indexed array. Arguments are sorted in the way - * they are submitted to the program. You can disable arguments - * through the 'arguments' flag of a parameter, if you want - * to disallow arguments. - * - * Arguments are either the last part of the program call (if the - * last parameter is not a 'multiple' one) or divided via the '--' - * method which is commonly used on Unix (if the last parameter - * accepts multiple values this is required). - * - * @return array(int=>string) Arguments. - */ - public function getArguments() - { - return $this->arguments; - } - - /** - * Get help information for your options. - * - * This method returns an array of help information for your options, - * indexed by int. Each help info has 2 fields: - * - * 0 => The options names (" / ") - * 1 => The help text (depending on the $long parameter) - * - * The $long options determines if you want to get the short- or longhelp - * texts. The array returned can be used by {@link ezcConsoleTable}. - * - * If using the second options, you can filter the options shown in the - * help output (e.g. to show short help for related options). Provide - * as simple number indexed array of short and/or long values to set a filter. - * - * @param bool $long Set this to true for getting the long help version. - * @param array(int=>string) $params Set of option names to generate help for, default is all. - * @return array(int=>array(int=>string)) Table structure as explained. - */ - public function getHelp( $long = false, array $params = array() ) - { - $help = array(); - foreach ( $this->options as $id => $param ) - { - if ( count( $params ) === 0 || in_array( $param->short, $params ) || in_array( $param->long, $params ) ) - { - $help[] = array( - ( $param->short !== "" ? '-' . $param->short . ' / ' : "" ) . '--' . $param->long, - $long == false ? $param->shorthelp : $param->longhelp, - ); - } - } - return $help; - } - - /** - * Get help information for your options as a table. - * - * This method provides the information returned by - * {@link ezcConsoleInput::getHelp()} in a table. - * - * @param ezcConsoleTable $table The table object to fill. - * @param bool $long Set this to true for getting the - * long help version. - * @param array(int=>string) $params Set of option names to generate help - * for, default is all. - * @return ezcConsoleTable The filled table. - */ - public function getHelpTable( ezcConsoleTable $table, $long = false, array $params = array() ) - { - $help = $this->getHelp( $long, $params ); - $i = 0; - foreach ( $help as $row ) - { - $table[$i][0]->content = $row[0]; - $table[$i++][1]->content = $row[1]; - } - return $table; - } - - /** - * Returns a standard help output for your program. - * - * This method generates a help text as it's commonly known from Unix - * command line programs. The output will contain the synopsis, your - * provided program description and the selected parameter help - * as also provided by {@link ezcConsoleInput::getHelp()}. The returned - * string can directly be printed to the console. - * - * @param string $programDesc The description of your program. - * @param int $width The width to adjust the output text to. - * @param bool $long Set this to true for getting the long - * help version. - * @param array(int=>string) $params Set of option names to generate help - * for, default is all. - * @return string The generated help text. - */ - public function getHelpText( $programDesc, $width = 80, $long = false, array $params = null ) - { - $help = $this->getHelp( $long, $params == null ? array() : $params ); - // Determine max length of first column text. - $maxLength = 0; - foreach ( $help as $row ) - { - $maxLength = max( $maxLength, strlen( $row[0] ) ); - } - // Width of left column - $leftColWidth = $maxLength + 2; - // Width of righ column - $rightColWidth = $width - $leftColWidth; - - $res = 'Usage: ' . $this->getSynopsis( $params ) . "\n"; - $res .= wordwrap( $programDesc, $width ); - $res .= "\n\n"; - foreach ( $help as $row ) - { - $rowParts = explode( "\n", wordwrap( $row[1], $rightColWidth ) ); - $res .= sprintf( "%-{$leftColWidth}s", $row[0] ); - $res .= $rowParts[0] . "\n"; - for ( $i = 1; $i < sizeof( $rowParts ); $i++ ) - { - $res .= str_repeat( ' ', $leftColWidth ) . $rowParts[$i] . "\n"; - } - } - return $res; - } - - /** - * Returns the synopsis string for the program. - * - * This gives you a synopsis definition for the options and arguments - * defined with this instance of ezcConsoleInput. You can filter the - * options named in the synopsis by submitting their short names in an - * array as the parameter of this method. If the parameter $optionNames - * is set, only those options are listed in the synopsis. - * - * @param array(int=>string) $optionNames - * @return string - */ - public function getSynopsis( array $optionNames = null ) - { - $usedOptions = array(); - $allowsArgs = true; - $synopsis = '$ ' . ( isset( $argv ) && sizeof( $argv ) > 0 ? $argv[0] : $_SERVER['argv'][0] ) . ' '; - foreach ( $this->getOptions() as $option ) - { - if ( $optionNames === null || is_array( $optionNames ) && ( in_array( $option->short, $optionNames ) || in_array( $option->long, $optionNames ) ) ) - { - $synopsis .= $this->createOptionSynopsis( $option, $usedOptions, $allowsArgs ); - } - } - $synopsis .= " [[--] ]"; - return $synopsis; - } - - /** - * Returns if a help option was set. - * This method returns if an option was submitted, which was defined to be - * a help option, using the isHelpOption flag. - * - * @return bool If a help option was set. - */ - public function helpOptionSet() - { - return $this->helpOptionSet; - } - - /** - * Returns the synopsis string for a single option and its dependencies. - * - * This method returns a part of the program synopsis, specifically for a - * certain parameter. The method recursively adds depending parameters up - * to the 2nd depth level to the synopsis. The second parameter is used - * to store the short names of all options that have already been used in - * the synopsis (to avoid adding an option twice). The 3rd parameter - * determines the actual deps in the option dependency recursion to - * terminate that after 2 recursions. - * - * @param ezcConsoleOption $option The option to include. - * @param array(int=>string) $usedOptions Array of used option short names. - * @param int $depth Current recursion depth. - * @return string The synopsis for this parameter. - */ - protected function createOptionSynopsis( ezcConsoleOption $option, &$usedOptions, $depth = 0 ) - { - $synopsis = ''; - - // Break after a nesting level of 2 - if ( $depth++ > 2 || in_array( $option->short, $usedOptions ) ) return $synopsis; - - $usedOptions[] = $option->short; - - $synopsis .= $option->short !== "" ? "-{$option->short}" : "--{$option->long}"; - - if ( isset( $option->default ) ) - { - $synopsis .= " " . ( $option->type === ezcConsoleInput::TYPE_STRING ? '"' : '' ) . $option->default . ( $option->type === ezcConsoleInput::TYPE_STRING ? '"' : '' ); - } - else if ( $option->type !== ezcConsoleInput::TYPE_NONE ) - { - $synopsis .= " "; - switch ( $option->type ) - { - case ezcConsoleInput::TYPE_STRING: - $synopsis .= ""; - break; - case ezcConsoleInput::TYPE_INT: - $synopsis .= ""; - break; - default: - $synopsis .= ""; - break; - } - } - - foreach ( $option->getDependencies() as $rule ) - { - $deeperSynopsis = $this->createOptionSynopsis( $rule->option, $usedOptions, $depth ); - $synopsis .= strlen( trim( $deeperSynopsis ) ) > 0 ? ' ' . $deeperSynopsis : ''; - } - - if ( $option->arguments === false ) - { - $allowsArgs = false; - } - - // Make the whole thing optional? - if ( $option->mandatory === false ) - { - $synopsis = "[$synopsis]"; - } - - return $synopsis . ' '; - } - - /** - * Process an option. - * - * This method does the processing of a single option. - * - * @param array(int=>string) $args The arguments array. - * @param int $i The current position in the arguments array. - * @return void - * - * @throws ezcConsoleOptionTooManyValuesException - * If an option that expects only a single value was submitted - * with multiple values. - * @throws ezcConsoleOptionTypeViolationException - * If an option was submitted with a value of the wrong type. - * @throws ezcConsoleOptionMissingValueException - * If an option thats expects a value was submitted without. - */ - private function processOptions( array $args, &$i ) - { - $option = $this->getOption( preg_replace( '/^-+/', '', $args[$i++] ) ); - // Is the actual option a help option? - if ( $option->isHelpOption === true ) - { - $this->helpOptionSet = true; - } - // No value expected - if ( $option->type === ezcConsoleInput::TYPE_NONE ) - { - // No value expected - if ( isset( $args[$i] ) && substr( $args[$i], 0, 1 ) !== '-' && sizeof( $args ) > ( $i + 1 ) ) - { - // But one found - throw new ezcConsoleOptionTypeViolationException( $option, $args[$i] ); - } - // Multiple occurance possible - if ( $option->multiple === true ) - { - $option->value[] = true; - } - else - { - $option->value = true; - } - // Everything fine, nothing to do - return $i; - } - // Value expected, check for it - if ( isset( $args[$i] ) && substr( $args[$i], 0, 1 ) !== '-' ) - { - // Type check - if ( $this->isCorrectType( $option, $args[$i] ) === false ) - { - throw new ezcConsoleOptionTypeViolationException( $option, $args[$i] ); - } - // Multiple values possible - if ( $option->multiple === true ) - { - $option->value[] = $args[$i]; - } - // Only single value expected, check for multiple - elseif ( isset( $option->value ) && $option->value !== false ) - { - throw new ezcConsoleOptionTooManyValuesException( $option ); - } - else - { - $option->value = $args[$i]; - } - $i++; - } - // Value found? If not, use default, if available - if ( !isset( $option->value ) || $option->value === false || ( is_array( $option->value ) && count( $option->value ) === 0) ) - { - throw new ezcConsoleOptionMissingValueException( $option ); - } - return $i; - } - - /** - * Process arguments given to the program. - * - * @param array(int=>string) $args The arguments array. - * @param int $i Current index in arguments array. - * @return void - */ - private function processArguments( array $args, &$i ) - { - while ( $i < count( $args ) ) - { - $this->arguments[] = $args[$i++]; - } - } - - /** - * Check the rules that may be associated with an option. - * - * Options are allowed to have rules associated for dependencies to other - * options and exclusion of other options or arguments. This method - * processes the checks. - * - * @throws ezcConsoleOptionDependencyViolationException - * If a dependency was violated. - * @throws ezcConsoleOptionExclusionViolationException - * If an exclusion rule was violated. - * @throws ezcConsoleOptionArgumentsViolationException - * If arguments are passed although a parameter dissallowed them. - * @throws ezcConsoleOptionMandatoryViolationException - * If an option that was marked mandatory was not submitted. - * @throws ezcConsoleOptionMissingValueException - * If an option that expects a value was submitted without one. - * @return void - */ - private function checkRules() - { - // If a help option is set, skip rule checking - if ( $this->helpOptionSet === true ) - { - return true; - } - $values = $this->getOptionValues(); - foreach ( $this->options as $id => $option ) - { - // Mandatory - if ( $option->mandatory === true && $option->value === false ) - { - throw new ezcConsoleOptionMandatoryViolationException( $option ); - } - // Not set and not mandatory? No checking. - if ( $option->value === false || is_array( $option->value ) && count( $option->value ) === 0 ) - { - // Default value to set? - if ( $option->default !== null ) - { - $option->value = $option->default; - } - // Parameter was not set so ignore it's rules. - continue; - } - - // Option was set, so check further on - - // Dependencies - foreach ( $option->getDependencies() as $dep ) - { - if ( !isset( $values[$dep->option->short] ) || $values[$dep->option->short] === false ) - { - throw new ezcConsoleOptionDependencyViolationException( $option, $dep->option ); - } - $depVals = $dep->values; - if ( count( $depVals ) > 0 ) - { - if ( !in_array( $values[$dep->option->short], $depVals ) ) - { - throw new ezcConsoleOptionDependencyViolationException( $option, $dep->option, implode( ', ', $depVals ) ); - } - } - } - // Exclusions - foreach ( $option->getExclusions() as $exc ) - { - if ( isset( $values[$exc->option->short] ) && $values[$exc->option->short] !== false ) - { - throw new ezcConsoleOptionExclusionViolationException( $option, $exc->option ); - } - $excVals = $exc->values; - if ( count( $excVals ) > 0 ) - { - if ( in_array( $values[$exc->option->short], $excVals ) ) - { - throw new ezcConsoleOptionExclusionViolationException( $option, $exc->option, $option->value ); - } - } - } - // Arguments - if ( $option->arguments === false && is_array( $this->arguments ) && count( $this->arguments ) > 0 ) - { - throw new ezcConsoleOptionArgumentsViolationException( $option ); - } - } - } - - /** - * Checks if a value is of a given type. Converts the value to the - * correct PHP type on success. - * - * @param ezcConsoleOption $option The option. - * @param string $val The value to check. - * @return bool True on succesful check, otherwise false. - */ - private function isCorrectType( ezcConsoleOption $option, &$val ) - { - $res = false; - switch ( $option->type ) - { - case ezcConsoleInput::TYPE_STRING: - $res = true; - $val = preg_replace( '/^(["\'])(.*)\1$/', '\2', $val ); - break; - case ezcConsoleInput::TYPE_INT: - $res = preg_match( '/^[0-9]+$/', $val ) ? true : false; - if ( $res ) - { - $val = ( int ) $val; - } - break; - } - return $res; - } - - /** - * Split parameter and value for long option names. - * - * This method checks for long options, if the value is passed using =. If - * this is the case parameter and value get split and replaced in the - * arguments array. - * - * @param array(int=>string) $args The arguments array - * @param int $i Current arguments array position - * @return void - */ - private function preprocessLongOption( array &$args, $i ) - { - // Value given? - if ( preg_match( '/^--\w+\=[^ ]/i', $args[$i] ) ) - { - // Split param and value and replace current param - $parts = explode( '=', $args[$i], 2 ); - array_splice( $args, $i, 1, $parts ); - } - } -} -?> + + * $optionHandler = new ezcConsoleInput(); + * + * // Register simple parameter -h/--help + * $optionHandler->registerOption( new ezcConsoleOption( 'h', 'help' ) ); + * + * // Register complex parameter -f/--file + * $file = new ezcConsoleOption( + * 'f', + * 'file', + * ezcConsoleInput::TYPE_STRING, + * null, + * false, + * 'Process a file.', + * 'Processes a single file.' + * ); + * $optionHandler->registerOption( $file ); + * + * // Manipulate parameter -f/--file after registration + * $file->multiple = true; + * + * // Register another complex parameter that depends on -f and excludes -h + * $dir = new ezcConsoleOption( + * 'd', + * 'dir', + * ezcConsoleInput::TYPE_STRING, + * null, + * true, + * 'Process a directory.', + * 'Processes a complete directory.', + * array( new ezcConsoleOptionRule( $optionHandler->getOption( 'f' ) ) ), + * array( new ezcConsoleOptionRule( $optionHandler->getOption( 'h' ) ) ) + * ); + * $optionHandler->registerOption( $dir ); + * + * // Register an alias for this parameter + * $optionHandler->registerAlias( 'e', 'extended-dir', $dir ); + * + * // Process registered parameters and handle errors + * try + * { + * $optionHandler->process( array( 'example_input.php', '-h' ) ); + * } + * catch ( ezcConsoleOptionException $e ) + * { + * echo $e->getMessage(); + * exit( 1 ); + * } + * + * // Process a single parameter + * $file = $optionHandler->getOption( 'f' ); + * if ( $file->value === false ) + * { + * echo "Parameter -{$file->short}/--{$file->long} was not submitted.\n"; + * } + * elseif ( $file->value === true ) + * { + * echo "Parameter -{$file->short}/--{$file->long} was submitted without value.\n"; + * } + * else + * { + * echo "Parameter -{$file->short}/--{$file->long} was submitted with value <".var_export($file->value, true).">.\n"; + * } + * + * // Process all parameters at once: + * foreach ( $optionHandler->getOptionValues() as $paramShort => $val ) + * { + * switch ( true ) + * { + * case $val === false: + * echo "Parameter $paramShort was not submitted.\n"; + * break; + * case $val === true: + * echo "Parameter $paramShort was submitted without a value.\n"; + * break; + * case is_array( $val ): + * echo "Parameter $paramShort was submitted multiple times with value: <".implode(', ', $val).">.\n"; + * break; + * default: + * echo "Parameter $paramShort was submitted with value: <$val>.\n"; + * break; + * } + * } + * + * + * @package ConsoleTools + * @version 1.1.3 + * @mainclass + */ +class ezcConsoleInput +{ + /** + * Option does not carry a value. + */ + const TYPE_NONE = 1; + + /** + * Option takes an integer value. + */ + const TYPE_INT = 2; + + /** + * Option takes a string value. + */ + const TYPE_STRING = 3; + + /** + * Array of option definitions, indexed by number. + * + * This array stores the ezcConsoleOption objects representing + * the options. + * + * For lookup of an option after its short or long values the attributes + * @link ezcConsoleInput::$optionShort + * @link ezcConsoleInput::$optionLong + * are used. + * + * @var array(int=>array) + */ + private $options = array(); + + /** + * Short option names. + * + * Each references a key in {@link ezcConsoleInput::$options}. + * + * @var array(string=>int) + */ + private $optionShort = array(); + + /** + * Long option names. + * + * Each references a key in {@link ezcConsoleInput::$options}. + * + * @var array(string=>int) + */ + private $optionLong = array(); + + /** + * Arguments, if submitted, are stored here. + * + * @var array(string) + */ + private $arguments = array(); + + + /** + * Indicates if an option was submitted, that has the isHelpOption flag set. + * + * @var bool + */ + private $helpOptionSet = false; + + /** + * Creates an input handler. + */ + public function __construct() + { + } + + /** + * Registers the new option $option. + * + * This method adds the new option $option to your option collection. If + * already an option with the assigned short or long value exists, an + * exception will be thrown. + * + * @see ezcConsoleInput::unregisterOption() + * + * @param ezcConsoleOption $option + * + * @return ezcConsoleOption The recently registered option. + */ + public function registerOption(ezcConsoleOption $option) + { + foreach ($this->optionShort as $short => $ref) { + if ($short === $option->short) { + throw new ezcConsoleOptionAlreadyRegisteredException($short); + } + } + foreach ($this->optionLong as $long => $ref) { + if ($long === $option->long) { + throw new ezcConsoleOptionAlreadyRegisteredException($long); + } + } + $this->options[] = $option; + $this->optionLong[$option->long] = $option; + if ($option->short !== "") { + $this->optionShort[$option->short] = $option; + } + return $option; + } + + /** + * Registers an alias for an option. + * + * Registers a new alias for an existing option. Aliases can + * be used as if they were a normal option. + * + * The alias is registered with the short option name $short and the + * long option name $long. The alias references to the existing + * option $option. + * + * @see ezcConsoleInput::unregisterAlias() + * + * @param string $short + * @param string $long + * @param ezcConsoleOption $option + * + * + * @throws ezcConsoleOptionNotExistsException + * If the referenced option is not registered. + * @throws ezcConsoleOptionAlreadyRegisteredException + * If another option/alias has taken the provided short or long name. + * @return void + */ + public function registerAlias($short, $long, ezcConsoleOption $option) + { + $short = $short; + $long = $long; + if (!isset($this->optionShort[$option->short]) || !isset($this->optionLong[$option->long])) { + throw new ezcConsoleOptionNotExistsException($option->long); + } + if (isset($this->optionShort[$short]) || isset($optionLong[$long])) { + throw new ezcConsoleOptionAlreadyRegisteredException(isset($this->optionShort[$short]) ? $this->optionShort[$short] : $this->optionLong[$long]); + } + $this->shortParam[$short] = $option; + $this->longParam[$long] = $option; + } + + /** + * Registers options according to a string specification. + * + * Accepts a string to define parameters and registers all parameters as + * options accordingly. String definition, specified in $optionDef, looks + * like this: + * + * + * [s:|size:][u:|user:][a:|all:] + * + * + * This string registers 3 parameters: + * -s / --size + * -u / --user + * -a / --all + * + * @param string $optionDef + * @return void + * + * @throws ezcConsoleOptionStringNotWellformedException + * If provided string does not have the correct format. + */ + public function registerOptionString($optionDef) + { + $regex = '/\[([a-z0-9-]+)([:?*+])?([^|]*)\|([a-z0-9-]+)([:?*+])?\]/'; + if (preg_match_all($regex, $optionDef, $matches)) { + foreach ($matches[1] as $id => $short) { + $option = null; + if (empty($matches[4][$id])) { + throw new ezcConsoleOptionStringNotWellformedException("Missing long parameter name for short parameter <-{$short}>"); + } + $option = new ezcConsoleOption($short, $matches[4][$id]); + if (!empty($matches[2][$id]) || !empty($matches[5][$id])) { + switch (!empty($matches[2][$id]) ? $matches[2][$id] : $matches[5][$id]) { + case '*': + // Allows 0 or more occurances + $option->multiple = true; + break; + case '+': + // Allows 1 or more occurances + $option->multiple = true; + $option->type = self::TYPE_STRING; + break; + case '?': + $option->type = self::TYPE_STRING; + $option->default = ''; + break; + default: + break; + } + } + if (!empty($matches[3][$id])) { + $option->default = $matches[3][$id]; + } + $this->registerOption($option); + } + } + } + + /** + * Removes an option. + * + * This function removes an option. All dependencies to that + * specific option are removed completely from every other registered + * option. + * + * @see ezcConsoleInput::registerOption() + * + * @param ezcConsoleOption $option The option object to unregister. + * + * @throws ezcConsoleOptionNotExistsException + * If requesting a not registered option. + * @return void + */ + public function unregisterOption(ezcConsoleOption $option) + { + $found = false; + foreach ($this->options as $id => $existParam) { + if ($existParam === $option) { + $found = true; + unset($this->options[$id]); + continue; + } + $existParam->removeAllExclusions($option); + $existParam->removeAllDependencies($option); + } + if ($found === false) { + throw new ezcConsoleOptionNotExistsException($option->long); + } + foreach ($this->optionLong as $name => $existParam) { + if ($existParam === $option) { + unset($this->optionLong[$name]); + } + } + foreach ($this->optionShort as $name => $existParam) { + if ($existParam === $option) { + unset($this->optionShort[$name]); + } + } + } + + /** + * Removes an alias to an option. + * + * This function removes an alias with the short name $short and long + * name $long. + * + * @see ezcConsoleInput::registerAlias() + * + * @throws ezcConsoleOptionNoAliasException + * If the requested short/long name belongs to a real parameter instead. + * + * @param string $short + * @param string $long + * @return void + * + * @todo Check if $short and $long refer to the same option! + */ + public function unregisterAlias($short, $long) + { + $short = $short; + $long = $long; + foreach ($this->options as $id => $option) { + if ($option->short === $short) { + throw new ezcConsoleOptionNoAliasException($short); + } + if ($option->long === $long) { + throw new ezcConsoleOptionNoAliasException($long); + } + } + if (isset($this->optionShort[$short])) { + unset($this->optionShort[$short]); + } + if (isset($this->optionLong[$short])) { + unset($this->optionLong[$long]); + } + } + + /** + * Returns the definition object for the option with the name $name. + * + * This method receives the long or short name of an option and + * returns the ezcConsoleOption object. + * + * @param string $name Short or long name of the option (without - or --). + * @return ezcConsoleOption + * + * @throws ezcConsoleOptionNotExistsException + * If requesting a not registered parameter. + */ + public function getOption($name) + { + $name = $name; + if (isset($this->optionShort[$name])) { + return $this->optionShort[$name]; + } + if (isset($this->optionLong[$name])) { + return $this->optionLong[$name]; + } + throw new ezcConsoleOptionNotExistsException($name); + } + + /** + * Process the input parameters. + * + * Actually process the input options and arguments according to the actual + * settings. + * + * Per default this method uses $argc and $argv for processing. You can + * override this setting with your own input, if necessary, using the + * parameters of this method. (Attention, first argument is always the pro + * gram name itself!) + * + * All exceptions thrown by this method contain an additional attribute "option" + * which specifies the parameter on which the error occurred. + * + * @param array(int=>string) $args The arguments + * @return void + * + * @throws ezcConsoleOptionNotExistsException + * If an option that was submitted does not exist. + * @throws ezcConsoleOptionDependencyViolationException + * If a dependency rule was violated. + * @throws ezcConsoleOptionExclusionViolationException + * If an exclusion rule was violated. + * @throws ezcConsoleOptionTypeViolationException + * If the type of a submitted value violates the options type rule. + * @throws ezcConsoleOptionArgumentsViolationException + * If arguments are passed although a parameter disallowed them. + * + * @see ezcConsoleOptionException + */ + public function process(array $args = null) + { + if (!isset($args)) { + $args = isset($argv) ? $argv : isset($_SERVER['argv']) ? $_SERVER['argv'] : array(); + } + $i = 1; + while ($i < count($args)) { + // Equalize parameter handling (long params with =) + if (substr($args[$i], 0, 2) == '--') { + $this->preprocessLongOption($args, $i); + } + // Check for parameter + if (substr($args[$i], 0, 1) === '-' && $this->hasOption(preg_replace('/^-*/', '', $args[$i])) !== false) { + $this->processOptions($args, $i); + } // Looks like parameter, but is not available?? + elseif (substr($args[$i], 0, 1) === '-' && trim($args[$i]) !== '--') { + throw new ezcConsoleOptionNotExistsException($args[$i]); + } // Must be the arguments + else { + $args[$i] == '--' ? ++$i : $i; + $this->processArguments($args, $i); + break; + } + } + $this->checkRules(); + } + + /** + * Returns true if an option with the given name exists, otherwise false. + * + * Checks if an option with the given name is registered. + * + * @param string $name Short or long name of the option. + * @return bool True if option exists, otherwise false. + */ + public function hasOption($name) + { + try { + $param = $this->getOption($name); + } catch (ezcConsoleOptionNotExistsException $e) { + return false; + } + return true; + } + + /** + * Returns an array of all registered options. + * + * Returns an array of all registered options in the following format: + * + * array( + * 0 => ezcConsoleOption, + * 1 => ezcConsoleOption, + * 2 => ezcConsoleOption, + * ... + * ); + * + * + * @return array(string=>ezcConsoleOption) Registered options. + */ + public function getOptions() + { + return $this->options; + } + + /** + * Returns the values of all submitted options. + * + * Returns an array of all values submitted to the options. The array is + * indexed by the parameters short name (excluding the '-' prefix). The array + * does not contain any parameter, which value is 'false' (meaning: the + * parameter was not submitted). + * + * @return array(string=>mixed) + */ + public function getOptionValues() + { + $res = array(); + foreach ($this->options as $param) { + if ($param->value !== false) { + $res[$param->short] = $param->value; + } + } + return $res; + } + + /** + * Returns arguments provided to the program. + * + * This method returns all arguments provided to a program in an + * int indexed array. Arguments are sorted in the way + * they are submitted to the program. You can disable arguments + * through the 'arguments' flag of a parameter, if you want + * to disallow arguments. + * + * Arguments are either the last part of the program call (if the + * last parameter is not a 'multiple' one) or divided via the '--' + * method which is commonly used on Unix (if the last parameter + * accepts multiple values this is required). + * + * @return array(int=>string) Arguments. + */ + public function getArguments() + { + return $this->arguments; + } + + /** + * Get help information for your options. + * + * This method returns an array of help information for your options, + * indexed by int. Each help info has 2 fields: + * + * 0 => The options names (" / ") + * 1 => The help text (depending on the $long parameter) + * + * The $long options determines if you want to get the short- or longhelp + * texts. The array returned can be used by {@link ezcConsoleTable}. + * + * If using the second options, you can filter the options shown in the + * help output (e.g. to show short help for related options). Provide + * as simple number indexed array of short and/or long values to set a filter. + * + * @param bool $long Set this to true for getting the long help version. + * @param array(int=>string) $params Set of option names to generate help for, default is all. + * @return array(int=>array(int=>string)) Table structure as explained. + */ + public function getHelp($long = false, array $params = array()) + { + $help = array(); + foreach ($this->options as $id => $param) { + if (count($params) === 0 || in_array($param->short, $params) || in_array($param->long, $params)) { + $help[] = array( + ( $param->short !== "" ? '-' . $param->short . ' / ' : "" ) . '--' . $param->long, + $long == false ? $param->shorthelp : $param->longhelp, + ); + } + } + return $help; + } + + /** + * Get help information for your options as a table. + * + * This method provides the information returned by + * {@link ezcConsoleInput::getHelp()} in a table. + * + * @param ezcConsoleTable $table The table object to fill. + * @param bool $long Set this to true for getting the + * long help version. + * @param array(int=>string) $params Set of option names to generate help + * for, default is all. + * @return ezcConsoleTable The filled table. + */ + public function getHelpTable(ezcConsoleTable $table, $long = false, array $params = array()) + { + $help = $this->getHelp($long, $params); + $i = 0; + foreach ($help as $row) { + $table[$i][0]->content = $row[0]; + $table[$i++][1]->content = $row[1]; + } + return $table; + } + + /** + * Returns a standard help output for your program. + * + * This method generates a help text as it's commonly known from Unix + * command line programs. The output will contain the synopsis, your + * provided program description and the selected parameter help + * as also provided by {@link ezcConsoleInput::getHelp()}. The returned + * string can directly be printed to the console. + * + * @param string $programDesc The description of your program. + * @param int $width The width to adjust the output text to. + * @param bool $long Set this to true for getting the long + * help version. + * @param array(int=>string) $params Set of option names to generate help + * for, default is all. + * @return string The generated help text. + */ + public function getHelpText($programDesc, $width = 80, $long = false, array $params = null) + { + $help = $this->getHelp($long, $params == null ? array() : $params); + // Determine max length of first column text. + $maxLength = 0; + foreach ($help as $row) { + $maxLength = max($maxLength, strlen($row[0])); + } + // Width of left column + $leftColWidth = $maxLength + 2; + // Width of righ column + $rightColWidth = $width - $leftColWidth; + + $res = 'Usage: ' . $this->getSynopsis($params) . "\n"; + $res .= wordwrap($programDesc, $width); + $res .= "\n\n"; + foreach ($help as $row) { + $rowParts = explode("\n", wordwrap($row[1], $rightColWidth)); + $res .= sprintf("%-{$leftColWidth}s", $row[0]); + $res .= $rowParts[0] . "\n"; + for ($i = 1; $i < sizeof($rowParts); $i++) { + $res .= str_repeat(' ', $leftColWidth) . $rowParts[$i] . "\n"; + } + } + return $res; + } + + /** + * Returns the synopsis string for the program. + * + * This gives you a synopsis definition for the options and arguments + * defined with this instance of ezcConsoleInput. You can filter the + * options named in the synopsis by submitting their short names in an + * array as the parameter of this method. If the parameter $optionNames + * is set, only those options are listed in the synopsis. + * + * @param array(int=>string) $optionNames + * @return string + */ + public function getSynopsis(array $optionNames = null) + { + $usedOptions = array(); + $allowsArgs = true; + $synopsis = '$ ' . ( isset($argv) && sizeof($argv) > 0 ? $argv[0] : $_SERVER['argv'][0] ) . ' '; + foreach ($this->getOptions() as $option) { + if ($optionNames === null || is_array($optionNames) && ( in_array($option->short, $optionNames) || in_array($option->long, $optionNames) )) { + $synopsis .= $this->createOptionSynopsis($option, $usedOptions, $allowsArgs); + } + } + $synopsis .= " [[--] ]"; + return $synopsis; + } + + /** + * Returns if a help option was set. + * This method returns if an option was submitted, which was defined to be + * a help option, using the isHelpOption flag. + * + * @return bool If a help option was set. + */ + public function helpOptionSet() + { + return $this->helpOptionSet; + } + + /** + * Returns the synopsis string for a single option and its dependencies. + * + * This method returns a part of the program synopsis, specifically for a + * certain parameter. The method recursively adds depending parameters up + * to the 2nd depth level to the synopsis. The second parameter is used + * to store the short names of all options that have already been used in + * the synopsis (to avoid adding an option twice). The 3rd parameter + * determines the actual deps in the option dependency recursion to + * terminate that after 2 recursions. + * + * @param ezcConsoleOption $option The option to include. + * @param array(int=>string) $usedOptions Array of used option short names. + * @param int $depth Current recursion depth. + * @return string The synopsis for this parameter. + */ + protected function createOptionSynopsis(ezcConsoleOption $option, &$usedOptions, $depth = 0) + { + $synopsis = ''; + + // Break after a nesting level of 2 + if ($depth++ > 2 || in_array($option->short, $usedOptions)) { + return $synopsis; + } + + $usedOptions[] = $option->short; + + $synopsis .= $option->short !== "" ? "-{$option->short}" : "--{$option->long}"; + + if (isset($option->default)) { + $synopsis .= " " . ( $option->type === ezcConsoleInput::TYPE_STRING ? '"' : '' ) . $option->default . ( $option->type === ezcConsoleInput::TYPE_STRING ? '"' : '' ); + } elseif ($option->type !== ezcConsoleInput::TYPE_NONE) { + $synopsis .= " "; + switch ($option->type) { + case ezcConsoleInput::TYPE_STRING: + $synopsis .= ""; + break; + case ezcConsoleInput::TYPE_INT: + $synopsis .= ""; + break; + default: + $synopsis .= ""; + break; + } + } + + foreach ($option->getDependencies() as $rule) { + $deeperSynopsis = $this->createOptionSynopsis($rule->option, $usedOptions, $depth); + $synopsis .= strlen(trim($deeperSynopsis)) > 0 ? ' ' . $deeperSynopsis : ''; + } + + if ($option->arguments === false) { + $allowsArgs = false; + } + + // Make the whole thing optional? + if ($option->mandatory === false) { + $synopsis = "[$synopsis]"; + } + + return $synopsis . ' '; + } + + /** + * Process an option. + * + * This method does the processing of a single option. + * + * @param array(int=>string) $args The arguments array. + * @param int $i The current position in the arguments array. + * @return void + * + * @throws ezcConsoleOptionTooManyValuesException + * If an option that expects only a single value was submitted + * with multiple values. + * @throws ezcConsoleOptionTypeViolationException + * If an option was submitted with a value of the wrong type. + * @throws ezcConsoleOptionMissingValueException + * If an option thats expects a value was submitted without. + */ + private function processOptions(array $args, &$i) + { + $option = $this->getOption(preg_replace('/^-+/', '', $args[$i++])); + // Is the actual option a help option? + if ($option->isHelpOption === true) { + $this->helpOptionSet = true; + } + // No value expected + if ($option->type === ezcConsoleInput::TYPE_NONE) { + // No value expected + if (isset($args[$i]) && substr($args[$i], 0, 1) !== '-' && sizeof($args) > ( $i + 1 )) { + // But one found + throw new ezcConsoleOptionTypeViolationException($option, $args[$i]); + } + // Multiple occurance possible + if ($option->multiple === true) { + $option->value[] = true; + } else { + $option->value = true; + } + // Everything fine, nothing to do + return $i; + } + // Value expected, check for it + if (isset($args[$i]) && substr($args[$i], 0, 1) !== '-') { + // Type check + if ($this->isCorrectType($option, $args[$i]) === false) { + throw new ezcConsoleOptionTypeViolationException($option, $args[$i]); + } + // Multiple values possible + if ($option->multiple === true) { + $option->value[] = $args[$i]; + } // Only single value expected, check for multiple + elseif (isset($option->value) && $option->value !== false) { + throw new ezcConsoleOptionTooManyValuesException($option); + } else { + $option->value = $args[$i]; + } + $i++; + } + // Value found? If not, use default, if available + if (!isset($option->value) || $option->value === false || ( is_array($option->value) && count($option->value) === 0)) { + throw new ezcConsoleOptionMissingValueException($option); + } + return $i; + } + + /** + * Process arguments given to the program. + * + * @param array(int=>string) $args The arguments array. + * @param int $i Current index in arguments array. + * @return void + */ + private function processArguments(array $args, &$i) + { + while ($i < count($args)) { + $this->arguments[] = $args[$i++]; + } + } + + /** + * Check the rules that may be associated with an option. + * + * Options are allowed to have rules associated for dependencies to other + * options and exclusion of other options or arguments. This method + * processes the checks. + * + * @throws ezcConsoleOptionDependencyViolationException + * If a dependency was violated. + * @throws ezcConsoleOptionExclusionViolationException + * If an exclusion rule was violated. + * @throws ezcConsoleOptionArgumentsViolationException + * If arguments are passed although a parameter dissallowed them. + * @throws ezcConsoleOptionMandatoryViolationException + * If an option that was marked mandatory was not submitted. + * @throws ezcConsoleOptionMissingValueException + * If an option that expects a value was submitted without one. + * @return void + */ + private function checkRules() + { + // If a help option is set, skip rule checking + if ($this->helpOptionSet === true) { + return true; + } + $values = $this->getOptionValues(); + foreach ($this->options as $id => $option) { + // Mandatory + if ($option->mandatory === true && $option->value === false) { + throw new ezcConsoleOptionMandatoryViolationException($option); + } + // Not set and not mandatory? No checking. + if ($option->value === false || is_array($option->value) && count($option->value) === 0) { + // Default value to set? + if ($option->default !== null) { + $option->value = $option->default; + } + // Parameter was not set so ignore it's rules. + continue; + } + + // Option was set, so check further on + + // Dependencies + foreach ($option->getDependencies() as $dep) { + if (!isset($values[$dep->option->short]) || $values[$dep->option->short] === false) { + throw new ezcConsoleOptionDependencyViolationException($option, $dep->option); + } + $depVals = $dep->values; + if (count($depVals) > 0) { + if (!in_array($values[$dep->option->short], $depVals)) { + throw new ezcConsoleOptionDependencyViolationException($option, $dep->option, implode(', ', $depVals)); + } + } + } + // Exclusions + foreach ($option->getExclusions() as $exc) { + if (isset($values[$exc->option->short]) && $values[$exc->option->short] !== false) { + throw new ezcConsoleOptionExclusionViolationException($option, $exc->option); + } + $excVals = $exc->values; + if (count($excVals) > 0) { + if (in_array($values[$exc->option->short], $excVals)) { + throw new ezcConsoleOptionExclusionViolationException($option, $exc->option, $option->value); + } + } + } + // Arguments + if ($option->arguments === false && is_array($this->arguments) && count($this->arguments) > 0) { + throw new ezcConsoleOptionArgumentsViolationException($option); + } + } + } + + /** + * Checks if a value is of a given type. Converts the value to the + * correct PHP type on success. + * + * @param ezcConsoleOption $option The option. + * @param string $val The value to check. + * @return bool True on succesful check, otherwise false. + */ + private function isCorrectType(ezcConsoleOption $option, &$val) + { + $res = false; + switch ($option->type) { + case ezcConsoleInput::TYPE_STRING: + $res = true; + $val = preg_replace('/^(["\'])(.*)\1$/', '\2', $val); + break; + case ezcConsoleInput::TYPE_INT: + $res = preg_match('/^[0-9]+$/', $val) ? true : false; + if ($res) { + $val = ( int ) $val; + } + break; + } + return $res; + } + + /** + * Split parameter and value for long option names. + * + * This method checks for long options, if the value is passed using =. If + * this is the case parameter and value get split and replaced in the + * arguments array. + * + * @param array(int=>string) $args The arguments array + * @param int $i Current arguments array position + * @return void + */ + private function preprocessLongOption(array &$args, $i) + { + // Value given? + if (preg_match('/^--\w+\=[^ ]/i', $args[$i])) { + // Split param and value and replace current param + $parts = explode('=', $args[$i], 2); + array_splice($args, $i, 1, $parts); + } + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/input/option.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/input/option.php index 1ce088b87feef6af418aba3a080ef0df011e75fe..f03cd9e7619af81f7907ab4184ef855be7a4425c 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/input/option.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/input/option.php @@ -1,575 +1,541 @@ -mixed) - */ - protected $properties; - - /** - * Dependency rules of this parameter. - * - * @see ezcConsoleParamemterStruct::addDependency() - * @see ezcConsoleParamemterStruct::removeDependency() - * @see ezcConsoleParamemterStruct::hasDependency() - * @see ezcConsoleParamemterStruct::getDependencies() - * @see ezcConsoleParamemterStruct::resetDependencies() - * - * @var array(string=>ezcConsoleParamemterRule) - */ - protected $dependencies = array(); - - /** - * Exclusion rules of this parameter. - * - * @see ezcConsoleParamemterStruct::addExclusion() - * @see ezcConsoleParamemterStruct::removeExclusion() - * @see ezcConsoleParamemterStruct::hasExclusion() - * @see ezcConsoleParamemterStruct::getExclusions() - * @see ezcConsoleParamemterStruct::resetExclusions() - * - * @var array(string=>ezcConsoleParamemterRule) - */ - protected $exclusions = array(); - - /** - * The value the parameter was assigned to when being submitted. - * Boolean false indicates the parameter was not submitted, boolean - * true means the parameter was submitted, but did not have a value. - * In any other case, this caries the submitted value. - * - * @var mixed - */ - public $value = false; - - /** - * Create a new parameter struct. - * Creates a new basic parameter struct with the base information "$short" - * (the short name of the parameter) and "$long" (the long version). You - * simply apply these parameters as strings (without '-' or '--'). So - * - * - * $param = new ezcConsoleOption( 'f', 'file' ); - * - * - * will result in a parameter that can be accessed using - * - * - * $ mytool -f - * - * - * or - * - * - * $ mytool --file - * - * . - * - * The newly created parameter contains only it's 2 names and each other - * attribute is set to it's default value. You can simply manipulate - * those attributes by accessing them directly. - * - * @param string $short Short name of the parameter without '-' (eg. 'f'). - * @param string $long Long name of the parameter without '--' (eg. 'file'). - * @param int $type Value type of the parameter. One of ezcConsoleInput::TYPE_*. - * @param mixed $default Default value the parameter holds if not submitted. - * @param bool $multiple If the parameter may be submitted multiple times. - * @param string $shorthelp Short help text. - * @param string $longhelp Long help text. - * @param array(int=>ezcConsoleOptionRule) $dependencies Dependency rules. - * @param array(int=>ezcConsoleOptionRule) $exclusions Exclusion rules. - * @param bool $arguments Whether supplying arguments is allowed when this parameter is set. - * @param bool $mandatory Whether the parameter must be always submitted. - * @param bool $isHelpOption Indicates that the given parameter is a help - * option. If a help option is set, all rule - * checking is skipped (dependency/exclusion/ - * mandatory). - * - * @throws ezcConsoleInvalidOptionNameException If the option names start with a "-" - * sign or contain whitespaces. - */ - public function __construct( - $short = '', - $long, - $type = ezcConsoleInput::TYPE_NONE, - $default = null, - $multiple = false, - $shorthelp = 'No help available.', - $longhelp = 'Sorry, there is no help text available for this parameter.', - array $dependencies = array(), - array $exclusions = array(), - $arguments = true, - $mandatory = false, - $isHelpOption = false - ) { - $this->properties['short'] = ''; - $this->properties['long'] = ''; - $this->properties['arguments'] = $arguments; - - if ( !self::validateOptionName( $short ) ) - { - throw new ezcConsoleInvalidOptionNameException( $short ); - } - $this->properties['short'] = $short; - - if ( !self::validateOptionName( $long ) ) - { - throw new ezcConsoleInvalidOptionNameException( $long ); - } - $this->properties['long'] = $long; - - $this->__set( "type", $type !== null ? $type : ezcConsoleInput::TYPE_NONE ); - $this->__set( "default", $default !== null ? $default : null ); - $this->__set( "multiple", $multiple !== null ? $multiple : false ); - $this->__set( "shorthelp", $shorthelp !== null ? $shorthelp : 'No help available.' ); - $this->__set( "longhelp", $longhelp !== null ? $longhelp : 'Sorry, there is no help text available for this parameter.' ); - - $dependencies = $dependencies !== null && is_array( $dependencies ) ? $dependencies : array(); - foreach ( $dependencies as $dep ) - { - $this->addDependency( $dep ); - } - - $exclusions = $exclusions !== null && is_array( $exclusions ) ? $exclusions : array(); - foreach ( $exclusions as $exc ) - { - $this->addExclusion( $exc ); - } - - $this->__set( "mandatory", $mandatory !== null ? $mandatory : false ); - $this->__set( "isHelpOption", $isHelpOption !== null ? $isHelpOption : false ); - } - - /* Add a new dependency for a parameter. - * This registeres a new dependency rule with the parameter. If you try - * to add an already registered rule it will simply be ignored. Else, - * the submitted rule will be added to the parameter as a dependency. - * - * @param ezcConsoleOptionRule $rule The rule to add. - * @return void - */ - public function addDependency( ezcConsoleOptionRule $rule ) - { - foreach ( $this->dependencies as $existRule ) - { - if ( $rule == $existRule ) - { - return; - } - } - $this->dependencies[] = $rule; - } - - /** - * Remove a dependency rule from a parameter. - * This removes a given rule from a parameter, if it exists. If the rule is - * not registered with the parameter, the method call will simply be ignored. - * - * @param ezcConsoleOptionRule $rule The rule to be removed. - * @return void - */ - public function removeDependency( ezcConsoleOptionRule $rule ) - { - foreach ( $this->dependencies as $id => $existRule ) - { - if ( $rule == $existRule ) - { - unset( $this->dependencies[$id] ); - } - } - } - - /** - * Remove all dependency rule referring to a parameter. - * This removes all dependency rules from a parameter, that refer to as specific - * parameter. If no rule is registered with this parameter as reference, the - * method call will simply be ignored. - * - * @param ezcConsoleOption $param The param to be check for rules. - * @return void - */ - public function removeAllDependencies( ezcConsoleOption $param ) - { - foreach ( $this->dependencies as $id => $rule ) - { - if ( $rule->option == $param ) - { - unset( $this->dependencies[$id] ); - } - } - } - - /** - * Returns if a given dependency rule is registered with the parameter. - * Returns true if the given rule is registered with this parameter, - * otherwise false. - * - * @param ezcConsoleOptionRule $rule The rule to be removed. - * @return bool True if rule is registered, otherwise false. - */ - public function hasDependency( ezcConsoleOption $param ) - { - foreach ( $this->dependencies as $id => $rule ) - { - if ( $rule->option == $param ) - { - return true; - } - } - return false; - } - - /** - * Returns the dependency rules registered with this parameter. - * Returns an array of registered dependencies. - * - * For example: - * - * array( - * 0 => ezcConsoleOptionRule, - * 1 => ezcConsoleOptionRule, - * 2 => ezcConsoleOptionRule, - * ); - * - * - * @return array Dependency definition as described or an empty array. - */ - public function getDependencies() - { - return $this->dependencies; - } - - /** - * Reset existing dependency rules. - * Deletes all registered dependency rules from the parameter definition. - * - * @return void - */ - public function resetDependencies() - { - $this->dependencies = array(); - } - - /* Add a new exclusion for a parameter. - * This registeres a new exclusion rule with the parameter. If you try - * to add an already registered rule it will simply be ignored. Else, - * the submitted rule will be added to the parameter as a exclusion. - * - * @param ezcConsoleOptionRule $rule The rule to add. - * @return void - */ - public function addExclusion( ezcConsoleOptionRule $rule ) - { - foreach ( $this->exclusions as $existRule ) - { - if ( $rule == $existRule ) - { - return; - } - } - $this->exclusions[] = $rule; - } - - /** - * Remove a exclusion rule from a parameter. - * This removes a given rule from a parameter, if it exists. If the rule is - * not registered with the parameter, the method call will simply be ignored. - * - * @param ezcConsoleOptionRule $rule The rule to be removed. - * @return void - */ - public function removeExclusion( ezcConsoleOptionRule $rule ) - { - foreach ( $this->exclusions as $id => $existRule ) - { - if ( $rule == $existRule ) - { - unset( $this->exclusions[$id] ); - } - } - } - - /** - * Remove all exclusion rule referring to a parameter. - * This removes all exclusion rules from a parameter, that refer to as specific - * parameter. If no rule is registered with this parameter as reference, the - * method call will simply be ignored. - * - * @param ezcConsoleOption $param The param to be check for rules. - * @return void - */ - public function removeAllExclusions( ezcConsoleOption $param ) - { - foreach ( $this->exclusions as $id => $rule ) - { - if ( $rule->option == $param ) - { - unset( $this->exclusions[$id] ); - } - } - } - - /** - * Returns if a given exclusion rule is registered with the parameter. - * Returns true if the given rule is registered with this parameter, - * otherwise false. - * - * @param ezcConsoleOptionRule $rule The rule to be removed. - * @return bool True if rule is registered, otherwise false. - */ - public function hasExclusion( ezcConsoleOption $param ) - { - foreach ( $this->exclusions as $id => $rule ) - { - if ( $rule->option == $param ) - { - return true; - } - } - return false; - } - - /** - * Returns the exclusion rules registered with this parameter. - * Returns an array of registered exclusions. - * - * For example: - * - * array( - * 0 => ezcConsoleOptionRule, - * 1 => ezcConsoleOptionRule, - * 2 => ezcConsoleOptionRule, - * ); - * - * - * @return array Exclusion definition as described or an empty array. - */ - public function getExclusions() - { - return $this->exclusions; - } - - /** - * Reset existing exclusion rules. - * Deletes all registered exclusion rules from the parameter definition. - * - * @return void - */ - public function resetExclusions() - { - $this->exclusions = array(); - } - - /** - * Property read access. - * Provides read access to the properties of the object. - * - * @param string $key The name of the property. - * @return mixed The value if property exists and isset, otherwise null. - * @ignore - */ - public function __get( $key ) - { - switch ( $key ) - { - case 'short': - case 'long': - case 'type': - case 'default': - case 'multiple': - case 'shorthelp': - case 'longhelp': - case 'arguments': - case 'isHelpOption': - case 'mandatory': - return $this->properties[$key]; - case 'dependencies': - default: - throw new ezcBasePropertyNotFoundException( $key ); - } - } - - /** - * Property write access. - * - * @param string $key Name of the property. - * @param mixed $val The value for the property. - * - * @throws ezcBasePropertyPermissionException - * If the property you try to access is read-only. - * @ignore - */ - public function __set( $key, $val ) - { - switch ( $key ) - { - case 'type': - if ( $val !== ezcConsoleInput::TYPE_NONE - && $val !== ezcConsoleInput::TYPE_INT - && $val !== ezcConsoleInput::TYPE_STRING ) - { - throw new ezcBaseValueException( - $key, - $val, - 'ezcConsoleInput::TYPE_STRING, ezcConsoleInput::TYPE_INT or ezcConsoleInput::TYPE_NONE' - ); - } - break; - case 'default': - if ( !is_string( $val ) && !is_numeric( $val ) && $val !== null ) - { - throw new ezcBaseValueException( $key, $val, 'a string or a number' ); - } - break; - case 'multiple': - if ( !is_bool( $val ) ) - { - throw new ezcBaseValueException( $key, $val, 'bool' ); - } - break; - case 'shorthelp': - if ( !is_string( $val ) ) - { - throw new ezcBaseValueException( $key, $val, 'string' ); - } - break; - case 'longhelp': - if ( !is_string( $val ) ) - { - throw new ezcBaseValueException( $key, $val, 'string' ); - } - break; - case 'arguments': - if ( !is_bool( $val ) ) - { - throw new ezcBaseValueException( $key, $val, 'bool' ); - } - break; - case 'mandatory': - if ( !is_bool( $val ) ) - { - throw new ezcBaseValueException( $key, $val, 'bool' ); - } - break; - case 'isHelpOption': - if ( !is_bool( $val ) ) - { - throw new ezcBaseValueException( $key, $val, 'bool' ); - } - break; - case 'long': - case 'short': - throw new ezcBasePropertyPermissionException( $key, ezcBasePropertyPermissionException::READ ); - break; - default: - throw new ezcBasePropertyNotFoundException( $key ); - break; - } - $this->properties[$key] = $val; - } - - /** - * Property isset access. - * - * @param string $key Name of the property. - * @return bool True is the property is set, otherwise false. - * @ignore - */ - public function __isset( $key ) - { - switch ( $key ) - { - case 'short': - case 'long': - case 'type': - case 'default': - case 'multiple': - case 'shorthelp': - case 'longhelp': - case 'arguments': - case 'isHelpOption': - case 'mandatory': - return ( $this->properties[$key] !== null ); - } - return false; - } - - /** - * Returns if a given name if valid for use as a parameter name a parameter. - * Checks if a given parameter name is generally valid for use. It checks a) - * that the name does not start with '-' or '--' and b) if it contains - * whitespaces. Note, that this method does not check any conflicts with already - * used parameter names. - * - * @param string $name The name to check. - * @return bool True if the name is valid, otherwise false. - */ - public static function validateOptionName( $name ) - { - if ( substr( $name, 0, 1 ) === '-' || strpos( $name, ' ' ) !== false ) - { - return false; - } - return true; - } -} - -?> +mixed) + */ + protected $properties; + + /** + * Dependency rules of this parameter. + * + * @see ezcConsoleParamemterStruct::addDependency() + * @see ezcConsoleParamemterStruct::removeDependency() + * @see ezcConsoleParamemterStruct::hasDependency() + * @see ezcConsoleParamemterStruct::getDependencies() + * @see ezcConsoleParamemterStruct::resetDependencies() + * + * @var array(string=>ezcConsoleParamemterRule) + */ + protected $dependencies = array(); + + /** + * Exclusion rules of this parameter. + * + * @see ezcConsoleParamemterStruct::addExclusion() + * @see ezcConsoleParamemterStruct::removeExclusion() + * @see ezcConsoleParamemterStruct::hasExclusion() + * @see ezcConsoleParamemterStruct::getExclusions() + * @see ezcConsoleParamemterStruct::resetExclusions() + * + * @var array(string=>ezcConsoleParamemterRule) + */ + protected $exclusions = array(); + + /** + * The value the parameter was assigned to when being submitted. + * Boolean false indicates the parameter was not submitted, boolean + * true means the parameter was submitted, but did not have a value. + * In any other case, this caries the submitted value. + * + * @var mixed + */ + public $value = false; + + /** + * Create a new parameter struct. + * Creates a new basic parameter struct with the base information "$short" + * (the short name of the parameter) and "$long" (the long version). You + * simply apply these parameters as strings (without '-' or '--'). So + * + * + * $param = new ezcConsoleOption( 'f', 'file' ); + * + * + * will result in a parameter that can be accessed using + * + * + * $ mytool -f + * + * + * or + * + * + * $ mytool --file + * + * . + * + * The newly created parameter contains only it's 2 names and each other + * attribute is set to it's default value. You can simply manipulate + * those attributes by accessing them directly. + * + * @param string $short Short name of the parameter without '-' (eg. 'f'). + * @param string $long Long name of the parameter without '--' (eg. 'file'). + * @param int $type Value type of the parameter. One of ezcConsoleInput::TYPE_*. + * @param mixed $default Default value the parameter holds if not submitted. + * @param bool $multiple If the parameter may be submitted multiple times. + * @param string $shorthelp Short help text. + * @param string $longhelp Long help text. + * @param array(int=>ezcConsoleOptionRule) $dependencies Dependency rules. + * @param array(int=>ezcConsoleOptionRule) $exclusions Exclusion rules. + * @param bool $arguments Whether supplying arguments is allowed when this parameter is set. + * @param bool $mandatory Whether the parameter must be always submitted. + * @param bool $isHelpOption Indicates that the given parameter is a help + * option. If a help option is set, all rule + * checking is skipped (dependency/exclusion/ + * mandatory). + * + * @throws ezcConsoleInvalidOptionNameException If the option names start with a "-" + * sign or contain whitespaces. + */ + public function __construct( + $short = '', + $long, + $type = ezcConsoleInput::TYPE_NONE, + $default = null, + $multiple = false, + $shorthelp = 'No help available.', + $longhelp = 'Sorry, there is no help text available for this parameter.', + array $dependencies = array(), + array $exclusions = array(), + $arguments = true, + $mandatory = false, + $isHelpOption = false + ) { + $this->properties['short'] = ''; + $this->properties['long'] = ''; + $this->properties['arguments'] = $arguments; + + if (!self::validateOptionName($short)) { + throw new ezcConsoleInvalidOptionNameException($short); + } + $this->properties['short'] = $short; + + if (!self::validateOptionName($long)) { + throw new ezcConsoleInvalidOptionNameException($long); + } + $this->properties['long'] = $long; + + $this->__set("type", $type !== null ? $type : ezcConsoleInput::TYPE_NONE); + $this->__set("default", $default !== null ? $default : null); + $this->__set("multiple", $multiple !== null ? $multiple : false); + $this->__set("shorthelp", $shorthelp !== null ? $shorthelp : 'No help available.'); + $this->__set("longhelp", $longhelp !== null ? $longhelp : 'Sorry, there is no help text available for this parameter.'); + + $dependencies = $dependencies !== null && is_array($dependencies) ? $dependencies : array(); + foreach ($dependencies as $dep) { + $this->addDependency($dep); + } + + $exclusions = $exclusions !== null && is_array($exclusions) ? $exclusions : array(); + foreach ($exclusions as $exc) { + $this->addExclusion($exc); + } + + $this->__set("mandatory", $mandatory !== null ? $mandatory : false); + $this->__set("isHelpOption", $isHelpOption !== null ? $isHelpOption : false); + } + + /* Add a new dependency for a parameter. + * This registeres a new dependency rule with the parameter. If you try + * to add an already registered rule it will simply be ignored. Else, + * the submitted rule will be added to the parameter as a dependency. + * + * @param ezcConsoleOptionRule $rule The rule to add. + * @return void + */ + public function addDependency(ezcConsoleOptionRule $rule) + { + foreach ($this->dependencies as $existRule) { + if ($rule == $existRule) { + return; + } + } + $this->dependencies[] = $rule; + } + + /** + * Remove a dependency rule from a parameter. + * This removes a given rule from a parameter, if it exists. If the rule is + * not registered with the parameter, the method call will simply be ignored. + * + * @param ezcConsoleOptionRule $rule The rule to be removed. + * @return void + */ + public function removeDependency(ezcConsoleOptionRule $rule) + { + foreach ($this->dependencies as $id => $existRule) { + if ($rule == $existRule) { + unset($this->dependencies[$id]); + } + } + } + + /** + * Remove all dependency rule referring to a parameter. + * This removes all dependency rules from a parameter, that refer to as specific + * parameter. If no rule is registered with this parameter as reference, the + * method call will simply be ignored. + * + * @param ezcConsoleOption $param The param to be check for rules. + * @return void + */ + public function removeAllDependencies(ezcConsoleOption $param) + { + foreach ($this->dependencies as $id => $rule) { + if ($rule->option == $param) { + unset($this->dependencies[$id]); + } + } + } + + /** + * Returns if a given dependency rule is registered with the parameter. + * Returns true if the given rule is registered with this parameter, + * otherwise false. + * + * @param ezcConsoleOptionRule $rule The rule to be removed. + * @return bool True if rule is registered, otherwise false. + */ + public function hasDependency(ezcConsoleOption $param) + { + foreach ($this->dependencies as $id => $rule) { + if ($rule->option == $param) { + return true; + } + } + return false; + } + + /** + * Returns the dependency rules registered with this parameter. + * Returns an array of registered dependencies. + * + * For example: + * + * array( + * 0 => ezcConsoleOptionRule, + * 1 => ezcConsoleOptionRule, + * 2 => ezcConsoleOptionRule, + * ); + * + * + * @return array Dependency definition as described or an empty array. + */ + public function getDependencies() + { + return $this->dependencies; + } + + /** + * Reset existing dependency rules. + * Deletes all registered dependency rules from the parameter definition. + * + * @return void + */ + public function resetDependencies() + { + $this->dependencies = array(); + } + + /* Add a new exclusion for a parameter. + * This registeres a new exclusion rule with the parameter. If you try + * to add an already registered rule it will simply be ignored. Else, + * the submitted rule will be added to the parameter as a exclusion. + * + * @param ezcConsoleOptionRule $rule The rule to add. + * @return void + */ + public function addExclusion(ezcConsoleOptionRule $rule) + { + foreach ($this->exclusions as $existRule) { + if ($rule == $existRule) { + return; + } + } + $this->exclusions[] = $rule; + } + + /** + * Remove a exclusion rule from a parameter. + * This removes a given rule from a parameter, if it exists. If the rule is + * not registered with the parameter, the method call will simply be ignored. + * + * @param ezcConsoleOptionRule $rule The rule to be removed. + * @return void + */ + public function removeExclusion(ezcConsoleOptionRule $rule) + { + foreach ($this->exclusions as $id => $existRule) { + if ($rule == $existRule) { + unset($this->exclusions[$id]); + } + } + } + + /** + * Remove all exclusion rule referring to a parameter. + * This removes all exclusion rules from a parameter, that refer to as specific + * parameter. If no rule is registered with this parameter as reference, the + * method call will simply be ignored. + * + * @param ezcConsoleOption $param The param to be check for rules. + * @return void + */ + public function removeAllExclusions(ezcConsoleOption $param) + { + foreach ($this->exclusions as $id => $rule) { + if ($rule->option == $param) { + unset($this->exclusions[$id]); + } + } + } + + /** + * Returns if a given exclusion rule is registered with the parameter. + * Returns true if the given rule is registered with this parameter, + * otherwise false. + * + * @param ezcConsoleOptionRule $rule The rule to be removed. + * @return bool True if rule is registered, otherwise false. + */ + public function hasExclusion(ezcConsoleOption $param) + { + foreach ($this->exclusions as $id => $rule) { + if ($rule->option == $param) { + return true; + } + } + return false; + } + + /** + * Returns the exclusion rules registered with this parameter. + * Returns an array of registered exclusions. + * + * For example: + * + * array( + * 0 => ezcConsoleOptionRule, + * 1 => ezcConsoleOptionRule, + * 2 => ezcConsoleOptionRule, + * ); + * + * + * @return array Exclusion definition as described or an empty array. + */ + public function getExclusions() + { + return $this->exclusions; + } + + /** + * Reset existing exclusion rules. + * Deletes all registered exclusion rules from the parameter definition. + * + * @return void + */ + public function resetExclusions() + { + $this->exclusions = array(); + } + + /** + * Property read access. + * Provides read access to the properties of the object. + * + * @param string $key The name of the property. + * @return mixed The value if property exists and isset, otherwise null. + * @ignore + */ + public function __get($key) + { + switch ($key) { + case 'short': + case 'long': + case 'type': + case 'default': + case 'multiple': + case 'shorthelp': + case 'longhelp': + case 'arguments': + case 'isHelpOption': + case 'mandatory': + return $this->properties[$key]; + case 'dependencies': + default: + throw new ezcBasePropertyNotFoundException($key); + } + } + + /** + * Property write access. + * + * @param string $key Name of the property. + * @param mixed $val The value for the property. + * + * @throws ezcBasePropertyPermissionException + * If the property you try to access is read-only. + * @ignore + */ + public function __set($key, $val) + { + switch ($key) { + case 'type': + if ($val !== ezcConsoleInput::TYPE_NONE + && $val !== ezcConsoleInput::TYPE_INT + && $val !== ezcConsoleInput::TYPE_STRING ) { + throw new ezcBaseValueException( + $key, + $val, + 'ezcConsoleInput::TYPE_STRING, ezcConsoleInput::TYPE_INT or ezcConsoleInput::TYPE_NONE' + ); + } + break; + case 'default': + if (!is_string($val) && !is_numeric($val) && $val !== null) { + throw new ezcBaseValueException($key, $val, 'a string or a number'); + } + break; + case 'multiple': + if (!is_bool($val)) { + throw new ezcBaseValueException($key, $val, 'bool'); + } + break; + case 'shorthelp': + if (!is_string($val)) { + throw new ezcBaseValueException($key, $val, 'string'); + } + break; + case 'longhelp': + if (!is_string($val)) { + throw new ezcBaseValueException($key, $val, 'string'); + } + break; + case 'arguments': + if (!is_bool($val)) { + throw new ezcBaseValueException($key, $val, 'bool'); + } + break; + case 'mandatory': + if (!is_bool($val)) { + throw new ezcBaseValueException($key, $val, 'bool'); + } + break; + case 'isHelpOption': + if (!is_bool($val)) { + throw new ezcBaseValueException($key, $val, 'bool'); + } + break; + case 'long': + case 'short': + throw new ezcBasePropertyPermissionException($key, ezcBasePropertyPermissionException::READ); + break; + default: + throw new ezcBasePropertyNotFoundException($key); + break; + } + $this->properties[$key] = $val; + } + + /** + * Property isset access. + * + * @param string $key Name of the property. + * @return bool True is the property is set, otherwise false. + * @ignore + */ + public function __isset($key) + { + switch ($key) { + case 'short': + case 'long': + case 'type': + case 'default': + case 'multiple': + case 'shorthelp': + case 'longhelp': + case 'arguments': + case 'isHelpOption': + case 'mandatory': + return ( $this->properties[$key] !== null ); + } + return false; + } + + /** + * Returns if a given name if valid for use as a parameter name a parameter. + * Checks if a given parameter name is generally valid for use. It checks a) + * that the name does not start with '-' or '--' and b) if it contains + * whitespaces. Note, that this method does not check any conflicts with already + * used parameter names. + * + * @param string $name The name to check. + * @return bool True if the name is valid, otherwise false. + */ + public static function validateOptionName($name) + { + if (substr($name, 0, 1) === '-' || strpos($name, ' ') !== false) { + return false; + } + return true; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/output.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/output.php index 880753cff0b24a07021c912eed37c3f2b9455280..4ebd663f192f923cf7d35d734ffc272d123a5015 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/output.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/output.php @@ -1,111 +1,101 @@ -mixed) $options The initial options to set. - * @return void - * - * @throws ezcBasePropertyNotFoundException - * If a the value for the property options is not an instance of - * @throws ezcBaseValueException - * If a the value for a property is out of range. - */ - public function __construct() - { - $this->properties['verbosityLevel'] = 1; - $this->properties['autobreak'] = 0; - $this->properties['useFormats'] = true; - $args = func_get_args(); - if ( func_num_args() === 1 && is_array( $args[0] ) ) - { - parent::__construct( $args[0] ); - } - else - { - foreach ( $args as $id => $val ) - { - switch ( $id ) - { - case 0: - $this->__set( "verbosityLevel", $val ); - break; - case 1: - $this->__set( "autobreak", $val ); - break; - case 2: - $this->__set( "useFormats", $val ); - break; - } - } - } - } - - /** - * Property write access. - * - * @throws ezcBasePropertyNotFoundException - * If a desired property could not be found. - * @throws ezcBaseSettingValueException - * If a desired property value is out of range. - * - * @param string $propertyName Name of the property. - * @param mixed $val The value for the property. - * @ignore - */ - public function __set( $propertyName, $val ) - { - switch ( $propertyName ) - { - case 'verbosityLevel': - case 'autobreak': - if ( !is_int( $val ) || $val < 0 ) - { - throw new ezcBaseSettingValueException( $propertyName, $val, 'int >= 0' ); - } - break; - case 'useFormats': - if ( !is_bool( $val ) ) - { - throw new ezcBaseSettingValueException( $propertyName, $val, 'bool' ); - } - break; - default: - throw new ezcBaseSettingNotFoundException( $propertyName ); - } - $this->properties[$propertyName] = $val; - } -} - -?> +mixed) $options The initial options to set. + * @return void + * + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + * @throws ezcBaseValueException + * If a the value for a property is out of range. + */ + public function __construct() + { + $this->properties['verbosityLevel'] = 1; + $this->properties['autobreak'] = 0; + $this->properties['useFormats'] = true; + $args = func_get_args(); + if (func_num_args() === 1 && is_array($args[0])) { + parent::__construct($args[0]); + } else { + foreach ($args as $id => $val) { + switch ($id) { + case 0: + $this->__set("verbosityLevel", $val); + break; + case 1: + $this->__set("autobreak", $val); + break; + case 2: + $this->__set("useFormats", $val); + break; + } + } + } + } + + /** + * Property write access. + * + * @throws ezcBasePropertyNotFoundException + * If a desired property could not be found. + * @throws ezcBaseSettingValueException + * If a desired property value is out of range. + * + * @param string $propertyName Name of the property. + * @param mixed $val The value for the property. + * @ignore + */ + public function __set($propertyName, $val) + { + switch ($propertyName) { + case 'verbosityLevel': + case 'autobreak': + if (!is_int($val) || $val < 0) { + throw new ezcBaseSettingValueException($propertyName, $val, 'int >= 0'); + } + break; + case 'useFormats': + if (!is_bool($val)) { + throw new ezcBaseSettingValueException($propertyName, $val, 'bool'); + } + break; + default: + throw new ezcBaseSettingNotFoundException($propertyName); + } + $this->properties[$propertyName] = $val; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/progressbar.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/progressbar.php index b933127af2e9390a20ea756bb8bc90ea94fd31d8..a3582dfa0f136a6f2516dc278d205095b0e1d7e9 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/progressbar.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/progressbar.php @@ -1,119 +1,113 @@ -mixed) $options The initial options to set. - * @return void - * - * @throws ezcBasePropertyNotFoundException - * If a the value for the property options is not an instance of - * @throws ezcBaseValueException - * If a the value for a property is out of range. - */ - public function __construct( array $options = array() ) - { - $this->properties['barChar'] = "+"; - $this->properties['emptyChar'] = "-"; - $this->properties['formatString'] = "%act% / %max% [%bar%] %fraction%%"; - $this->properties['fractionFormat'] = "%01.2f"; - $this->properties['progressChar'] = ">"; - $this->properties['redrawFrequency'] = 1; - $this->properties['step'] = 1; - $this->properties['width'] = 78; - $this->properties['actFormat'] = '%.0f'; - $this->properties['maxFormat'] = '%.0f'; - parent::__construct( $options ); - } - - /** - * Option write access. - * - * @throws ezcBasePropertyNotFoundException - * If a desired property could not be found. - * @throws ezcBaseSettingValueException - * If a desired property value is out of range. - * - * @param string $key Name of the property. - * @param mixed $value The value for the property. - * @ignore - */ - public function __set( $key, $value ) - { - switch ( $key ) - { - case "barChar": - case "emptyChar": - case "progressChar": - case "formatString": - case "fractionFormat": - case "actFormat": - case "maxFormat": - if ( strlen( $value ) < 1 ) - { - throw new ezcBaseSettingValueException( $key, $value, 'string, not empty' ); - } - break; - case "width": - if ( !is_int( $value ) || $value < 5 ) - { - throw new ezcBaseSettingValueException( $key, $value, 'int >= 5' ); - } - break; - case "redrawFrequency": - case "step": - if ( ( !is_int( $value ) && !is_float( $value ) ) || $value < 1 ) - { - throw new ezcBaseSettingValueException( $key, $value, 'int > 0' ); - } - break; - default: - throw new ezcBaseSettingNotFoundException( $key ); - } - $this->properties[$key] = $value; - } -} - -?> +mixed) $options The initial options to set. + * @return void + * + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + * @throws ezcBaseValueException + * If a the value for a property is out of range. + */ + public function __construct(array $options = array()) + { + $this->properties['barChar'] = "+"; + $this->properties['emptyChar'] = "-"; + $this->properties['formatString'] = "%act% / %max% [%bar%] %fraction%%"; + $this->properties['fractionFormat'] = "%01.2f"; + $this->properties['progressChar'] = ">"; + $this->properties['redrawFrequency'] = 1; + $this->properties['step'] = 1; + $this->properties['width'] = 78; + $this->properties['actFormat'] = '%.0f'; + $this->properties['maxFormat'] = '%.0f'; + parent::__construct($options); + } + + /** + * Option write access. + * + * @throws ezcBasePropertyNotFoundException + * If a desired property could not be found. + * @throws ezcBaseSettingValueException + * If a desired property value is out of range. + * + * @param string $key Name of the property. + * @param mixed $value The value for the property. + * @ignore + */ + public function __set($key, $value) + { + switch ($key) { + case "barChar": + case "emptyChar": + case "progressChar": + case "formatString": + case "fractionFormat": + case "actFormat": + case "maxFormat": + if (strlen($value) < 1) { + throw new ezcBaseSettingValueException($key, $value, 'string, not empty'); + } + break; + case "width": + if (!is_int($value) || $value < 5) { + throw new ezcBaseSettingValueException($key, $value, 'int >= 5'); + } + break; + case "redrawFrequency": + case "step": + if (( !is_int($value) && !is_float($value) ) || $value < 1) { + throw new ezcBaseSettingValueException($key, $value, 'int > 0'); + } + break; + default: + throw new ezcBaseSettingNotFoundException($key); + } + $this->properties[$key] = $value; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/progressmonitor.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/progressmonitor.php index 7681794a3dbbf02fecbc1df29b08621305201812..4e66f7ce891310879c9ceae3b9913fa44398f5be 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/progressmonitor.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/progressmonitor.php @@ -1,73 +1,69 @@ -mixed) $options The initial options to set. - * @return void - * - * @throws ezcBasePropertyNotFoundException - * If a the value for the property options is not an instance of - * @throws ezcBaseValueException - * If a the value for a property is out of range. - */ - public function __construct( array $options = array() ) - { - $this->properties['formatString'] = '%8.1f%% %s %s'; - parent::__construct( $options ); - } - - /** - * Option write access. - * - * @throws ezcBasePropertyNotFoundException - * If a desired property could not be found. - * @throws ezcBaseSettingValueException - * If a desired property value is out of range. - * - * @param string $key Name of the property. - * @param mixed $value The value for the property. - * @ignore - */ - public function __set( $key, $value ) - { - switch ( $key ) - { - case "formatString": - if ( strlen( $value ) < 1 ) - { - throw new ezcBaseSettingValueException( $key, $value, 'string, not empty' ); - } - break; - default: - throw new ezcBaseSettingNotFoundException( $key ); - } - $this->properties[$key] = $value; - } -} - -?> +mixed) $options The initial options to set. + * @return void + * + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + * @throws ezcBaseValueException + * If a the value for a property is out of range. + */ + public function __construct(array $options = array()) + { + $this->properties['formatString'] = '%8.1f%% %s %s'; + parent::__construct($options); + } + + /** + * Option write access. + * + * @throws ezcBasePropertyNotFoundException + * If a desired property could not be found. + * @throws ezcBaseSettingValueException + * If a desired property value is out of range. + * + * @param string $key Name of the property. + * @param mixed $value The value for the property. + * @ignore + */ + public function __set($key, $value) + { + switch ($key) { + case "formatString": + if (strlen($value) < 1) { + throw new ezcBaseSettingValueException($key, $value, 'string, not empty'); + } + break; + default: + throw new ezcBaseSettingNotFoundException($key); + } + $this->properties[$key] = $value; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/statusbar.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/statusbar.php index c327eb64d2ac6c8a1b7557219ecccc1c84fc711c..159dc8a1cc06f7b7f259e8a7d6fb6411e4c0543a 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/statusbar.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/statusbar.php @@ -1,77 +1,73 @@ -mixed) $options The initial options to set. - * @return void - * - * @throws ezcBasePropertyNotFoundException - * If a the value for the property options is not an instance of - * @throws ezcBaseValueException - * If a the value for a property is out of range. - */ - public function __construct( array $options = array() ) - { - $this->properties['successChar'] = "+"; - $this->properties['failureChar'] = "-"; - parent::__construct( $options ); - } - - /** - * Option write access. - * - * @throws ezcBasePropertyNotFoundException - * If a desired property could not be found. - * @throws ezcBaseSettingValueException - * If a desired property value is out of range. - * - * @param string $key Name of the property. - * @param mixed $value The value for the property. - * @ignore - */ - public function __set( $key, $value ) - { - switch ( $key ) - { - case "successChar": - case "failureChar": - if ( strlen( $value ) < 1 ) - { - throw new ezcBaseSettingValueException( $key, $value, 'string, not empty' ); - } - break; - default: - throw new ezcBaseSettingNotFoundException( $key ); - } - $this->properties[$key] = $value; - } -} - -?> +mixed) $options The initial options to set. + * @return void + * + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + * @throws ezcBaseValueException + * If a the value for a property is out of range. + */ + public function __construct(array $options = array()) + { + $this->properties['successChar'] = "+"; + $this->properties['failureChar'] = "-"; + parent::__construct($options); + } + + /** + * Option write access. + * + * @throws ezcBasePropertyNotFoundException + * If a desired property could not be found. + * @throws ezcBaseSettingValueException + * If a desired property value is out of range. + * + * @param string $key Name of the property. + * @param mixed $value The value for the property. + * @ignore + */ + public function __set($key, $value) + { + switch ($key) { + case "successChar": + case "failureChar": + if (strlen($value) < 1) { + throw new ezcBaseSettingValueException($key, $value, 'string, not empty'); + } + break; + default: + throw new ezcBaseSettingNotFoundException($key); + } + $this->properties[$key] = $value; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/table.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/table.php index a90a9b15652c11c1e6ca4da1d15ea27c57d78f25..b557bd69213614014cfd48543eb532201fc8710e 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/table.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/options/table.php @@ -1,197 +1,181 @@ -mixed) $options The initial options to set. - * @return void - * - * @throws ezcBasePropertyNotFoundException - * If the value for the property options is not an instance of - * @throws ezcBaseValueException - * If the value for a property is out of range. - */ - public function __construct() - { - $this->properties['colWidth'] = 'auto'; - $this->properties['colWrap'] = ezcConsoleTable::WRAP_AUTO; - $this->properties['defaultAlign'] = ezcConsoleTable::ALIGN_LEFT; - $this->properties['colPadding'] = ' '; - $this->properties['widthType'] = ezcConsoleTable::WIDTH_MAX; - $this->properties['lineVertical'] = '-'; - $this->properties['lineHorizontal'] = '|'; - $this->properties['corner'] = '+'; - $this->properties['defaultFormat'] = 'default'; - $this->properties['defaultBorderFormat'] = 'default'; - - $args = func_get_args(); - if ( func_num_args() === 1 && is_array( $args[0] ) && !is_int( key( $args[0] ) ) ) - { - parent::__construct( $args[0] ); - } - else - { - foreach ( $args as $id => $val ) - { - switch ( $id ) - { - case 0: - $this->__set( 'colWidth', $val ); - break; - case 1: - $this->__set( 'colWrap', $val ); - break; - case 2: - $this->__set( 'defaultAlign', $val ); - break; - case 3: - $this->__set( 'colPadding', $val ); - break; - case 4: - $this->__set( 'widthType', $val ); - break; - case 5: - $this->__set( 'lineVertical', $val ); - break; - case 6: - $this->__set( 'lineHorizontal', $val ); - break; - case 7: - $this->__set( 'corner', $val ); - break; - case 8: - $this->__set( 'defaultFormat', $val ); - break; - case 9: - $this->__set( 'defaultBorderFormat', $val ); - break; - } - } - } - } - - /** - * Property write access. - * - * @throws ezcBasePropertyNotFoundException - * If a desired property could not be found. - * @throws ezcBaseSettingValueException - * If a desired property value is out of range. - * - * @param string $propertyName Name of the property. - * @param mixed $val The value for the property. - * @ignore - */ - public function __set( $propertyName, $val ) - { - switch ( $propertyName ) - { - case 'colWidth': - if ( !is_array( $val ) && is_string( $val ) && $val !== 'auto' ) - { - throw new ezcBaseSettingValueException( $propertyName, $val, 'array(int) or "auto"' ); - } - break; - case 'colWrap': - if ( $val !== ezcConsoleTable::WRAP_AUTO && $val !== ezcConsoleTable::WRAP_NONE && $val !== ezcConsoleTable::WRAP_CUT ) - { - throw new ezcBaseSettingValueException( $propertyName, $val, 'ezcConsoleTable::WRAP_AUTO, ezcConsoleTable::WRAP_NONE, ezcConsoleTable::WRAP_CUT' ); - } - break; - case 'defaultAlign': - if ( $val !== ezcConsoleTable::ALIGN_DEFAULT && $val !== ezcConsoleTable::ALIGN_LEFT && $val !== ezcConsoleTable::ALIGN_CENTER && $val !== ezcConsoleTable::ALIGN_RIGHT ) - { - throw new ezcBaseSettingValueException( $propertyName, $val, 'ezcConsoleTable::ALIGN_DEFAULT, ezcConsoleTable::ALIGN_LEFT, ezcConsoleTable::ALIGN_CENTER, ezcConsoleTable::ALIGN_RIGHT' ); - } - break; - case 'colPadding': - if ( !is_string( $val ) ) - { - throw new ezcBaseSettingValueException( $propertyName, $val, 'string' ); - } - break; - case 'widthType': - if ( $val !== ezcConsoleTable::WIDTH_MAX && $val !== ezcConsoleTable::WIDTH_FIXED ) - { - throw new ezcBaseSettingValueException( $propertyName, $val, 'ezcConsoleTable::WIDTH_MAX, ezcConsoleTable::WIDTH_FIXED' ); - } - break; - case 'lineVertical': - case 'lineHorizontal': - case 'corner': - if ( !is_string( $val ) && strlen( $val ) !== 1 ) - { - throw new ezcBaseSettingValueException( $propertyName, $val, 'string, length = 1' ); - } - break; - case 'defaultFormat': - if ( !is_string( $val ) || strlen( $val ) < 1 ) - { - throw new ezcBaseSettingValueException( $propertyName, $val, 'string, length = 1' ); - } - break; - case 'defaultBorderFormat': - if ( !is_string( $val ) || strlen( $val ) < 1 ) - { - throw new ezcBaseSettingValueException( $propertyName, $val, 'string, length = 1' ); - } - break; - default: - throw new ezcBaseSettingNotFoundException( $propertyName ); - } - $this->properties[$propertyName] = $val; - } -} - -?> +mixed) $options The initial options to set. + * @return void + * + * @throws ezcBasePropertyNotFoundException + * If the value for the property options is not an instance of + * @throws ezcBaseValueException + * If the value for a property is out of range. + */ + public function __construct() + { + $this->properties['colWidth'] = 'auto'; + $this->properties['colWrap'] = ezcConsoleTable::WRAP_AUTO; + $this->properties['defaultAlign'] = ezcConsoleTable::ALIGN_LEFT; + $this->properties['colPadding'] = ' '; + $this->properties['widthType'] = ezcConsoleTable::WIDTH_MAX; + $this->properties['lineVertical'] = '-'; + $this->properties['lineHorizontal'] = '|'; + $this->properties['corner'] = '+'; + $this->properties['defaultFormat'] = 'default'; + $this->properties['defaultBorderFormat'] = 'default'; + + $args = func_get_args(); + if (func_num_args() === 1 && is_array($args[0]) && !is_int(key($args[0]))) { + parent::__construct($args[0]); + } else { + foreach ($args as $id => $val) { + switch ($id) { + case 0: + $this->__set('colWidth', $val); + break; + case 1: + $this->__set('colWrap', $val); + break; + case 2: + $this->__set('defaultAlign', $val); + break; + case 3: + $this->__set('colPadding', $val); + break; + case 4: + $this->__set('widthType', $val); + break; + case 5: + $this->__set('lineVertical', $val); + break; + case 6: + $this->__set('lineHorizontal', $val); + break; + case 7: + $this->__set('corner', $val); + break; + case 8: + $this->__set('defaultFormat', $val); + break; + case 9: + $this->__set('defaultBorderFormat', $val); + break; + } + } + } + } + + /** + * Property write access. + * + * @throws ezcBasePropertyNotFoundException + * If a desired property could not be found. + * @throws ezcBaseSettingValueException + * If a desired property value is out of range. + * + * @param string $propertyName Name of the property. + * @param mixed $val The value for the property. + * @ignore + */ + public function __set($propertyName, $val) + { + switch ($propertyName) { + case 'colWidth': + if (!is_array($val) && is_string($val) && $val !== 'auto') { + throw new ezcBaseSettingValueException($propertyName, $val, 'array(int) or "auto"'); + } + break; + case 'colWrap': + if ($val !== ezcConsoleTable::WRAP_AUTO && $val !== ezcConsoleTable::WRAP_NONE && $val !== ezcConsoleTable::WRAP_CUT) { + throw new ezcBaseSettingValueException($propertyName, $val, 'ezcConsoleTable::WRAP_AUTO, ezcConsoleTable::WRAP_NONE, ezcConsoleTable::WRAP_CUT'); + } + break; + case 'defaultAlign': + if ($val !== ezcConsoleTable::ALIGN_DEFAULT && $val !== ezcConsoleTable::ALIGN_LEFT && $val !== ezcConsoleTable::ALIGN_CENTER && $val !== ezcConsoleTable::ALIGN_RIGHT) { + throw new ezcBaseSettingValueException($propertyName, $val, 'ezcConsoleTable::ALIGN_DEFAULT, ezcConsoleTable::ALIGN_LEFT, ezcConsoleTable::ALIGN_CENTER, ezcConsoleTable::ALIGN_RIGHT'); + } + break; + case 'colPadding': + if (!is_string($val)) { + throw new ezcBaseSettingValueException($propertyName, $val, 'string'); + } + break; + case 'widthType': + if ($val !== ezcConsoleTable::WIDTH_MAX && $val !== ezcConsoleTable::WIDTH_FIXED) { + throw new ezcBaseSettingValueException($propertyName, $val, 'ezcConsoleTable::WIDTH_MAX, ezcConsoleTable::WIDTH_FIXED'); + } + break; + case 'lineVertical': + case 'lineHorizontal': + case 'corner': + if (!is_string($val) && strlen($val) !== 1) { + throw new ezcBaseSettingValueException($propertyName, $val, 'string, length = 1'); + } + break; + case 'defaultFormat': + if (!is_string($val) || strlen($val) < 1) { + throw new ezcBaseSettingValueException($propertyName, $val, 'string, length = 1'); + } + break; + case 'defaultBorderFormat': + if (!is_string($val) || strlen($val) < 1) { + throw new ezcBaseSettingValueException($propertyName, $val, 'string, length = 1'); + } + break; + default: + throw new ezcBaseSettingNotFoundException($propertyName); + } + $this->properties[$propertyName] = $val; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/output.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/output.php index b2b39aa778e6c027e111f407b2cfdaa3408c0ab2..afbc209b9f88788a9b391e0925ae46ef3233f0ab 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/output.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/output.php @@ -1,502 +1,477 @@ - - * // Create the output handler - * $out = new ezcConsoleOutput(); - * - * // Set the verbosity to level 10 - * $out->options->verbosityLevel = 10; - * // Enable auto wrapping of lines after 40 characters - * $out->options->autobreak = 40; - * - * // Set the color of the default output format to green - * $out->formats->default->color = 'green'; - * - * // Set the color of the output format named 'success' to white - * $out->formats->success->color = 'white'; - * // Set the style of the output format named 'success' to bold - * $out->formats->success->style = array( 'bold' ); - * - * // Set the color of the output format named 'failure' to red - * $out->formats->failure->color = 'red'; - * // Set the style of the output format named 'failure' to bold - * $out->formats->failure->style = array( 'bold' ); - * // Set the background color of the output format named 'failure' to blue - * $out->formats->failure->bgcolor = 'blue'; - * - * // Output text with default format - * $out->outputText( 'This is default text ' ); - * // Output text with format 'success' - * $out->outputText( 'including success message', 'success' ); - * // Some more output with default output. - * $out->outputText( "and a manual linebreak.\n" ); - * - * // Manipulate the later output - * $out->formats->success->color = 'green'; - * $out->formats->default->color = 'blue'; - * - * // This is visible, since we set verboseLevel to 10, and printed in default format (now blue) - * $out->outputText( "Some verbose output.\n", null, 10 ); - * // This is not visible, since we set verboseLevel to 10 - * $out->outputText( "Some more verbose output.\n", null, 20 ); - * // This is visible, since we set verboseLevel to 10, and printed in format 'failure' - * $out->outputText( "And some not so verbose, failure output.\n", 'failure', 5 ); - * - * - * For a list of valid colors, style attributes and background colors, please - * refer to {@link ezcConsoleOutputFormat}. - * - * @property ezcConsoleOutputOptions $options - * Contains the options for this class. - * @property ezcConsoleOutputFormats $formats - * Contains the output formats. - * - * @package ConsoleTools - * @version 1.1.3 - * @mainclass - */ -class ezcConsoleOutput -{ - /** - * Container to hold the properties - * - * @var array(string=>mixed) - */ - protected $properties; - - /** - * Whether a position has been stored before, using the storePos() method. - * - * @see ezcConsoleOutput::storePos() - * @var bool - */ - protected $positionStored = false; - - /** - * Stores the mapping of color names to their escape - * sequence values. - * - * @var array(string=>int) - */ - protected static $color = array( - 'gray' => 30, - 'black' => 30, // Alias black to gray (Bug #8478) - 'red' => 31, - 'green' => 32, - 'yellow' => 33, - 'blue' => 34, - 'magenta' => 35, - 'cyan' => 36, - 'white' => 37, - 'default' => 39 - ); - - /** - * Stores the mapping of bgcolor names to their escape - * sequence values. - * - * @var array(string=>int) - */ - protected static $bgcolor = array( - 'gray' => 40, // Alias gray to black (Bug #8478) - 'black' => 40, - 'red' => 41, - 'green' => 42, - 'yellow' => 43, - 'blue' => 44, - 'magenta' => 45, - 'cyan' => 46, - 'white' => 47, - 'default' => 49, - ); - - /** - * Stores the mapping of styles names to their escape - * sequence values. - * - * @var array(string=>int) - */ - protected static $style = array( - 'default' => '0', - - 'bold' => 1, - 'faint' => 2, - 'normal' => 22, - - 'italic' => 3, - 'notitalic' => 23, - - 'underlined' => 4, - 'doubleunderlined' => 21, - 'notunderlined' => 24, - - 'blink' => 5, - 'blinkfast' => 6, - 'noblink' => 25, - - 'negative' => 7, - 'positive' => 27, - ); - - /** - * Basic escape sequence string. Use sprintf() to insert escape codes. - * - * @var string - */ - private $escapeSequence = "\033[%sm"; - - /** - * Create a new console output handler. - * - * @see ezcConsoleOutput::$options - * @see ezcConsoleOutputOptions - * @see ezcConsoleOutput::$formats - * @see ezcConsoleOutputFormats - * - * @param ezcConsoleOutputFormats $formats Formats to be used for output. - * @param array(string=>string) $options Options to set. - */ - public function __construct( ezcConsoleOutputFormats $formats = null, array $options = array() ) - { - $options = isset( $options ) ? $options : new ezcConsoleOutputOptions(); - $formats = isset( $formats ) ? $formats : new ezcConsoleOutputFormats(); - $this->properties['options'] = new ezcConsoleOutputOptions( $options ); - $this->properties['formats'] = $formats; - } - - /** - * Set new options. - * This method allows you to change the options of an output handler. - * - * @param ezcConsoleOutputOptions $options The options to set. - * - * @throws ezcBaseSettingNotFoundException - * If you tried to set a non-existent option value. - * @throws ezcBaseSettingValueException - * If the value is not valid for the desired option. - * @throws ezcBaseValueException - * If you submit neither an array nor an instance of - * ezcConsoleOutputOptions. - */ - public function setOptions( $options ) - { - if ( is_array( $options ) ) - { - $this->properties['options']->merge( $options ); - } - else if ( $options instanceof ezcConsoleOutputOptions ) - { - $this->properties['options'] = $options; - } - else - { - throw new ezcBaseValueException( "options", $options, "instance of ezcConsoleOutputOptions" ); - } - } - - /** - * Returns the current options. - * Returns the options currently set for this output handler. - * - * @return ezcConsoleOutputOptions The current options. - */ - public function getOptions() - { - return $this->properties['options']; - } - - /** - * Property read access. - * - * @throws ezcBasePropertyNotFoundException - * If the the desired property is not found. - * - * @param string $propertyName Name of the property. - * @return mixed Value of the property or null. - * @ignore - */ - public function __get( $propertyName ) - { - switch ( $propertyName ) - { - case 'options': - case 'formats': - return $this->properties[$propertyName]; - default: - break; - } - throw new ezcBasePropertyNotFoundException( $propertyName ); - } - - /** - * Property write access. - * - * @param string $propertyName Name of the property. - * @param mixed $val The value for the property. - * - * @throws ezcBaseValueException - * If a the value for the property options is not an instance of - * ezcConsoleOutputOptions. - * @throws ezcBaseValueException - * If a the value for the property formats is not an instance of - * ezcConsoleOutputFormats. - * @ignore - */ - public function __set( $propertyName, $val ) - { - switch ( $propertyName ) - { - case 'options': - if ( !( $val instanceof ezcConsoleOutputOptions ) ) - { - throw new ezcBaseValueException( $key, $val, 'ezcConsoleOutputOptions' ); - } - $this->properties['options'] = $val; - return; - case 'formats': - if ( !( $val instanceof ezcConsoleOutputFormats ) ) - { - throw new ezcBaseValueException( $key, $val, 'ezcConsoleOutputFormats' ); - } - $this->properties['formats'] = $val; - return; - default: - break; - } - throw new ezcBasePropertyNotFoundException( $propertyName ); - } - - /** - * Property isset access. - * - * @param string $propertyName Name of the property. - * @return bool True is the property is set, otherwise false. - * @ignore - */ - public function __isset( $propertyName ) - { - switch ( $propertyName ) - { - case 'options': - case 'formats': - return true; - } - return false; - } - - /** - * Print text to the console. - * - * Output a string to the console. If $format parameter is omitted, - * the default style is chosen. Style can either be a special style - * {@link ezcConsoleOutput::$options}, a style name - * {@link ezcConsoleOutput$formats} or 'none' to print without any styling. - * - * @param string $text The text to print. - * @param string $format Format chosen for printing. - * @param int $verbosityLevel On which verbose level to output this message. - * @return void - */ - public function outputText( $text, $format = 'default', $verbosityLevel = 1 ) - { - if ( $this->properties['options']->verbosityLevel >= $verbosityLevel ) - { - if ( is_int( $this->properties['options']->autobreak ) && $this->properties['options']->autobreak > 0 ) - { - $textLines = explode( "\n", $text ); - foreach ( $textLines as $id => $textLine ) - { - $textLines[$id] = wordwrap( $textLine, $this->properties['options']->autobreak, "\n", true ); - } - $text = implode( "\n", $textLines ); - } - echo ( $this->properties['options']->useFormats == true ) ? $this->formatText( $text, $format ) : $text; - } - } - - /** - * Print text to the console and automatically append a line break. - * - * This method acts similar to {@link ezcConsoleOutput::outputText()}, in - * fact it even uses it. The difference is, that outputLine() - * automatically appends a manual line break to the printed text. Besides - * that, you can leave out the $text parameter of outputLine() to only - * print a line break. - * - * @param string $text The text to print. - * @param string $format Format chosen for printing. - * @param int $verbosityLevel On which verbose level to output this message. - * @return void - */ - public function outputLine( $text = '', $format = 'default', $verbosityLevel = 1 ) - { - $this->outputText( $text, $format, $verbosityLevel ); - $this->outputText( PHP_EOL, null, $verbosityLevel ); - } - - /** - * Returns a formated version of the text. - * - * If $format parameter is omitted, the default style is chosen. The format - * must be a valid registered format definition. For information on the - * formats, see {@link ezcConsoleOutput::$formats}. - * - * @param string $text Text to apply style to. - * @param string $format Format chosen to be applied. - * @return string - */ - public function formatText( $text, $format = 'default' ) - { - return $this->buildSequence( $format ) . $text . $this->buildSequence( 'default' ); - } - - /** - * Stores the current cursor position. - * - * Saves the current cursor position to return to it using - * {@link ezcConsoleOutput::restorePos()}. Multiple calls - * to this method will override each other. Only the last - * position is saved. - * - * @return void - */ - public function storePos() - { - echo "\033[s"; - $this->positionStored = true; - } - - /** - * Restores a cursor position. - * - * Restores the cursor position last saved using {@link - * ezcConsoleOutput::storePos()}. - * - * @todo Gnome terminal does not recognize this codes. Solution?? - * - * @throws ezcConsoleNoPositionStoredException - * If no position is saved. - * @return void - */ - public function restorePos() - { - if ( $this->positionStored === false ) - { - throw new ezcConsoleNoPositionStoredException(); - } - echo "\033[u"; - } - - /** - * Move the cursor to a specific column of the current line. - * - * Moves the cursor to a specific column index of the current line (default - * is 1). - * - * @param int $column Column to jump to. - * @return void - */ - public function toPos( $column = 1 ) - { - echo "\033[{$column}G"; - } - - /** - * Returns if a format code is valid for ta specific formating option. - * - * This method determines if a given code is valid for a specific - * formatting option ('color', 'bgcolor' or 'style'). - * - * @see ezcConsoleOutput::getFormatCode(); - * - * @param string $type Formating type. - * @param string $key Format option name. - * @return bool True if the code is valid. - */ - public static function isValidFormatCode( $type, $key ) - { - return isset( self::${$type}[$key] ); - } - - /** - * Returns the escape sequence for a specific format. - * - * Returns the default format escape sequence, if the requested format does - * not exist. - * - * @param string $format Name of the format. - * @return string The escape sequence. - */ - protected function buildSequence( $format = 'default' ) - { - if ( $format === 'default' ) - { - return sprintf( $this->escapeSequence, 0 ); - } - $modifiers = array(); - $formats = array( 'color', 'style', 'bgcolor' ); - foreach ( $formats as $formatType ) - { - // Get modifiers - if ( is_array( $this->formats->$format->$formatType ) ) - { - if ( !in_array( 'default', $this->formats->$format->$formatType ) ) - { - foreach ( $this->formats->$format->$formatType as $singleVal ) - { - $modifiers[] = $this->getFormatCode( $formatType, $singleVal ); - } - } - } - else - { - if ( $this->formats->$format->$formatType !== 'default' ) - { - $modifiers[] = $this->getFormatCode( $formatType, $this->formats->$format->$formatType ); - } - } - } - // Merge modifiers - return sprintf( $this->escapeSequence, implode( ';', $modifiers ) ); - } - - /** - * Returns the code for a given formating option of a given type. - * - * $type is the type of formating ('color', 'bgcolor' or 'style'), $key the - * name of the format to lookup. Returns the numeric code for the requested - * format or 0 if format or type do not exist. - * - * @see ezcConsoleOutput::isValidFormatCode() - * - * @param string $type Formatting type. - * @param string $key Format option name. - * @return int The code representation. - */ - protected function getFormatCode( $type, $key ) - { - if ( !ezcConsoleOutput::isValidFormatCode( $type, $key ) ) - { - return 0; - } - return ezcConsoleOutput::${$type}[$key]; - } - -} -?> + + * // Create the output handler + * $out = new ezcConsoleOutput(); + * + * // Set the verbosity to level 10 + * $out->options->verbosityLevel = 10; + * // Enable auto wrapping of lines after 40 characters + * $out->options->autobreak = 40; + * + * // Set the color of the default output format to green + * $out->formats->default->color = 'green'; + * + * // Set the color of the output format named 'success' to white + * $out->formats->success->color = 'white'; + * // Set the style of the output format named 'success' to bold + * $out->formats->success->style = array( 'bold' ); + * + * // Set the color of the output format named 'failure' to red + * $out->formats->failure->color = 'red'; + * // Set the style of the output format named 'failure' to bold + * $out->formats->failure->style = array( 'bold' ); + * // Set the background color of the output format named 'failure' to blue + * $out->formats->failure->bgcolor = 'blue'; + * + * // Output text with default format + * $out->outputText( 'This is default text ' ); + * // Output text with format 'success' + * $out->outputText( 'including success message', 'success' ); + * // Some more output with default output. + * $out->outputText( "and a manual linebreak.\n" ); + * + * // Manipulate the later output + * $out->formats->success->color = 'green'; + * $out->formats->default->color = 'blue'; + * + * // This is visible, since we set verboseLevel to 10, and printed in default format (now blue) + * $out->outputText( "Some verbose output.\n", null, 10 ); + * // This is not visible, since we set verboseLevel to 10 + * $out->outputText( "Some more verbose output.\n", null, 20 ); + * // This is visible, since we set verboseLevel to 10, and printed in format 'failure' + * $out->outputText( "And some not so verbose, failure output.\n", 'failure', 5 ); + * + * + * For a list of valid colors, style attributes and background colors, please + * refer to {@link ezcConsoleOutputFormat}. + * + * @property ezcConsoleOutputOptions $options + * Contains the options for this class. + * @property ezcConsoleOutputFormats $formats + * Contains the output formats. + * + * @package ConsoleTools + * @version 1.1.3 + * @mainclass + */ +class ezcConsoleOutput +{ + /** + * Container to hold the properties + * + * @var array(string=>mixed) + */ + protected $properties; + + /** + * Whether a position has been stored before, using the storePos() method. + * + * @see ezcConsoleOutput::storePos() + * @var bool + */ + protected $positionStored = false; + + /** + * Stores the mapping of color names to their escape + * sequence values. + * + * @var array(string=>int) + */ + protected static $color = array( + 'gray' => 30, + 'black' => 30, // Alias black to gray (Bug #8478) + 'red' => 31, + 'green' => 32, + 'yellow' => 33, + 'blue' => 34, + 'magenta' => 35, + 'cyan' => 36, + 'white' => 37, + 'default' => 39 + ); + + /** + * Stores the mapping of bgcolor names to their escape + * sequence values. + * + * @var array(string=>int) + */ + protected static $bgcolor = array( + 'gray' => 40, // Alias gray to black (Bug #8478) + 'black' => 40, + 'red' => 41, + 'green' => 42, + 'yellow' => 43, + 'blue' => 44, + 'magenta' => 45, + 'cyan' => 46, + 'white' => 47, + 'default' => 49, + ); + + /** + * Stores the mapping of styles names to their escape + * sequence values. + * + * @var array(string=>int) + */ + protected static $style = array( + 'default' => '0', + + 'bold' => 1, + 'faint' => 2, + 'normal' => 22, + + 'italic' => 3, + 'notitalic' => 23, + + 'underlined' => 4, + 'doubleunderlined' => 21, + 'notunderlined' => 24, + + 'blink' => 5, + 'blinkfast' => 6, + 'noblink' => 25, + + 'negative' => 7, + 'positive' => 27, + ); + + /** + * Basic escape sequence string. Use sprintf() to insert escape codes. + * + * @var string + */ + private $escapeSequence = "\033[%sm"; + + /** + * Create a new console output handler. + * + * @see ezcConsoleOutput::$options + * @see ezcConsoleOutputOptions + * @see ezcConsoleOutput::$formats + * @see ezcConsoleOutputFormats + * + * @param ezcConsoleOutputFormats $formats Formats to be used for output. + * @param array(string=>string) $options Options to set. + */ + public function __construct(ezcConsoleOutputFormats $formats = null, array $options = array()) + { + $options = isset($options) ? $options : new ezcConsoleOutputOptions(); + $formats = isset($formats) ? $formats : new ezcConsoleOutputFormats(); + $this->properties['options'] = new ezcConsoleOutputOptions($options); + $this->properties['formats'] = $formats; + } + + /** + * Set new options. + * This method allows you to change the options of an output handler. + * + * @param ezcConsoleOutputOptions $options The options to set. + * + * @throws ezcBaseSettingNotFoundException + * If you tried to set a non-existent option value. + * @throws ezcBaseSettingValueException + * If the value is not valid for the desired option. + * @throws ezcBaseValueException + * If you submit neither an array nor an instance of + * ezcConsoleOutputOptions. + */ + public function setOptions($options) + { + if (is_array($options)) { + $this->properties['options']->merge($options); + } elseif ($options instanceof ezcConsoleOutputOptions) { + $this->properties['options'] = $options; + } else { + throw new ezcBaseValueException("options", $options, "instance of ezcConsoleOutputOptions"); + } + } + + /** + * Returns the current options. + * Returns the options currently set for this output handler. + * + * @return ezcConsoleOutputOptions The current options. + */ + public function getOptions() + { + return $this->properties['options']; + } + + /** + * Property read access. + * + * @throws ezcBasePropertyNotFoundException + * If the the desired property is not found. + * + * @param string $propertyName Name of the property. + * @return mixed Value of the property or null. + * @ignore + */ + public function __get($propertyName) + { + switch ($propertyName) { + case 'options': + case 'formats': + return $this->properties[$propertyName]; + default: + break; + } + throw new ezcBasePropertyNotFoundException($propertyName); + } + + /** + * Property write access. + * + * @param string $propertyName Name of the property. + * @param mixed $val The value for the property. + * + * @throws ezcBaseValueException + * If a the value for the property options is not an instance of + * ezcConsoleOutputOptions. + * @throws ezcBaseValueException + * If a the value for the property formats is not an instance of + * ezcConsoleOutputFormats. + * @ignore + */ + public function __set($propertyName, $val) + { + switch ($propertyName) { + case 'options': + if (!( $val instanceof ezcConsoleOutputOptions )) { + throw new ezcBaseValueException($key, $val, 'ezcConsoleOutputOptions'); + } + $this->properties['options'] = $val; + return; + case 'formats': + if (!( $val instanceof ezcConsoleOutputFormats )) { + throw new ezcBaseValueException($key, $val, 'ezcConsoleOutputFormats'); + } + $this->properties['formats'] = $val; + return; + default: + break; + } + throw new ezcBasePropertyNotFoundException($propertyName); + } + + /** + * Property isset access. + * + * @param string $propertyName Name of the property. + * @return bool True is the property is set, otherwise false. + * @ignore + */ + public function __isset($propertyName) + { + switch ($propertyName) { + case 'options': + case 'formats': + return true; + } + return false; + } + + /** + * Print text to the console. + * + * Output a string to the console. If $format parameter is omitted, + * the default style is chosen. Style can either be a special style + * {@link ezcConsoleOutput::$options}, a style name + * {@link ezcConsoleOutput$formats} or 'none' to print without any styling. + * + * @param string $text The text to print. + * @param string $format Format chosen for printing. + * @param int $verbosityLevel On which verbose level to output this message. + * @return void + */ + public function outputText($text, $format = 'default', $verbosityLevel = 1) + { + if ($this->properties['options']->verbosityLevel >= $verbosityLevel) { + if (is_int($this->properties['options']->autobreak) && $this->properties['options']->autobreak > 0) { + $textLines = explode("\n", $text); + foreach ($textLines as $id => $textLine) { + $textLines[$id] = wordwrap($textLine, $this->properties['options']->autobreak, "\n", true); + } + $text = implode("\n", $textLines); + } + echo ( $this->properties['options']->useFormats == true ) ? $this->formatText($text, $format) : $text; + } + } + + /** + * Print text to the console and automatically append a line break. + * + * This method acts similar to {@link ezcConsoleOutput::outputText()}, in + * fact it even uses it. The difference is, that outputLine() + * automatically appends a manual line break to the printed text. Besides + * that, you can leave out the $text parameter of outputLine() to only + * print a line break. + * + * @param string $text The text to print. + * @param string $format Format chosen for printing. + * @param int $verbosityLevel On which verbose level to output this message. + * @return void + */ + public function outputLine($text = '', $format = 'default', $verbosityLevel = 1) + { + $this->outputText($text, $format, $verbosityLevel); + $this->outputText(PHP_EOL, null, $verbosityLevel); + } + + /** + * Returns a formated version of the text. + * + * If $format parameter is omitted, the default style is chosen. The format + * must be a valid registered format definition. For information on the + * formats, see {@link ezcConsoleOutput::$formats}. + * + * @param string $text Text to apply style to. + * @param string $format Format chosen to be applied. + * @return string + */ + public function formatText($text, $format = 'default') + { + return $this->buildSequence($format) . $text . $this->buildSequence('default'); + } + + /** + * Stores the current cursor position. + * + * Saves the current cursor position to return to it using + * {@link ezcConsoleOutput::restorePos()}. Multiple calls + * to this method will override each other. Only the last + * position is saved. + * + * @return void + */ + public function storePos() + { + echo "\033[s"; + $this->positionStored = true; + } + + /** + * Restores a cursor position. + * + * Restores the cursor position last saved using {@link + * ezcConsoleOutput::storePos()}. + * + * @todo Gnome terminal does not recognize this codes. Solution?? + * + * @throws ezcConsoleNoPositionStoredException + * If no position is saved. + * @return void + */ + public function restorePos() + { + if ($this->positionStored === false) { + throw new ezcConsoleNoPositionStoredException(); + } + echo "\033[u"; + } + + /** + * Move the cursor to a specific column of the current line. + * + * Moves the cursor to a specific column index of the current line (default + * is 1). + * + * @param int $column Column to jump to. + * @return void + */ + public function toPos($column = 1) + { + echo "\033[{$column}G"; + } + + /** + * Returns if a format code is valid for ta specific formating option. + * + * This method determines if a given code is valid for a specific + * formatting option ('color', 'bgcolor' or 'style'). + * + * @see ezcConsoleOutput::getFormatCode(); + * + * @param string $type Formating type. + * @param string $key Format option name. + * @return bool True if the code is valid. + */ + public static function isValidFormatCode($type, $key) + { + return isset(self::${$type}[$key]); + } + + /** + * Returns the escape sequence for a specific format. + * + * Returns the default format escape sequence, if the requested format does + * not exist. + * + * @param string $format Name of the format. + * @return string The escape sequence. + */ + protected function buildSequence($format = 'default') + { + if ($format === 'default') { + return sprintf($this->escapeSequence, 0); + } + $modifiers = array(); + $formats = array( 'color', 'style', 'bgcolor' ); + foreach ($formats as $formatType) { + // Get modifiers + if (is_array($this->formats->$format->$formatType)) { + if (!in_array('default', $this->formats->$format->$formatType)) { + foreach ($this->formats->$format->$formatType as $singleVal) { + $modifiers[] = $this->getFormatCode($formatType, $singleVal); + } + } + } else { + if ($this->formats->$format->$formatType !== 'default') { + $modifiers[] = $this->getFormatCode($formatType, $this->formats->$format->$formatType); + } + } + } + // Merge modifiers + return sprintf($this->escapeSequence, implode(';', $modifiers)); + } + + /** + * Returns the code for a given formating option of a given type. + * + * $type is the type of formating ('color', 'bgcolor' or 'style'), $key the + * name of the format to lookup. Returns the numeric code for the requested + * format or 0 if format or type do not exist. + * + * @see ezcConsoleOutput::isValidFormatCode() + * + * @param string $type Formatting type. + * @param string $key Format option name. + * @return int The code representation. + */ + protected function getFormatCode($type, $key) + { + if (!ezcConsoleOutput::isValidFormatCode($type, $key)) { + return 0; + } + return ezcConsoleOutput::${$type}[$key]; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/progressbar.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/progressbar.php index 5e9a06114ba4fd26b8a9fd2f5d0daf018edeb28e..33721caac913e6df5c153d2ff8aaa698a967e05e 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/progressbar.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/progressbar.php @@ -1,437 +1,418 @@ - - * $out = new ezcConsoleOutput(); - * - * // Create progress bar itself - * $progress = new ezcConsoleProgressbar( $out, 100, array( 'step' => 5 ) ); - * - * $progress->options->emptyChar = '-'; - * $progress->options->progressChar = '#'; - * $progress->options->formatString = "Uploading file : %act%/%max% kb [%bar%]"; - * - * // Perform actions - * $i = 0; - * while ( $i++ < 20 ) - * { - * // Do whatever you want to indicate progress for - * usleep( mt_rand( 20000, 2000000 ) ); - * // Advance the progressbar by one step ( uploading 5k per run ) - * $progress->advance(); - * } - * - * // Finish progress bar and jump to next line. - * $progress->finish(); - * - * $out->outputText( "Successfully uploaded .\n", 'success' ); - * - * - * @property ezcConsoleProgressbarOptions $options - * Contains the options for this class. - * @property int $max - * The maximum progress value to reach. - * - * @package ConsoleTools - * @version 1.1.3 - * @mainclass - */ -class ezcConsoleProgressbar -{ - /** - * Container to hold the properties - * - * @var array(string=>mixed) - */ - protected $properties; - - /** - * Storage for actual values to be replaced in the format string. - * Actual values are stored here and will be inserted into the bar - * before printing it. - * - * @var array(string => string) - */ - protected $valueMap = array( - 'bar' => '', - 'fraction' => '', - 'act' => '', - 'max' => '', - ); - - /** - * Stores the bar utilization. - * - * This array saves how much space a specific part of the bar utilizes to not - * recalculate those on every step. - * - * @var array(string => int) - */ - protected $measures = array( - 'barSpace' => 0, - 'fractionSpace' => 0, - 'actSpace' => 0, - 'maxSpace' => 0, - 'fixedCharSpace' => 0, - ); - - /** - * The current step the progress bar should show. - * - * @var int - */ - protected $currentStep = 0; - - /** - * The maximum number of steps to go. - * Calculated once from the settings. - * - * @var int - */ - protected $numSteps = 0; - - /** - * The ezcConsoleOutput object to use. - * - * @var ezcConsoleOutput - */ - protected $output; - - /** - * Indicates if the starting point for the bar has been stored. - * Per default this is false to indicate that no start position has been - * stored, yet. - * - * @var bool - */ - protected $started = false; - - /** - * Creates a new progress bar. - * - * @param ezcConsoleOutput $outHandler Handler to utilize for output - * @param int $max Maximum value, where progressbar - * reaches 100%. - * @param array(string=>string) $options Options - * - * @see ezcConsoleProgressbar::$options - */ - public function __construct( ezcConsoleOutput $outHandler, $max, array $options = array() ) - { - $this->output = $outHandler; - $this->__set( 'max', $max ); - $this->properties['options'] = new ezcConsoleProgressbarOptions( $options ); - } - - /** - * Set new options. - * This method allows you to change the options of progressbar. - * - * @param ezcConsoleProgresbarOptions $options The options to set. - * - * @throws ezcBaseSettingNotFoundException - * If you tried to set a non-existent option value. - * @throws ezcBaseSettingValueException - * If the value is not valid for the desired option. - * @throws ezcBaseValueException - * If you submit neither an array nor an instance of - * ezcConsoleProgresbarOptions. - */ - public function setOptions( $options ) - { - if ( is_array( $options ) ) - { - $this->properties['options']->merge( $options ); - } - else if ( $options instanceof ezcConsoleProgressbarOptions ) - { - $this->properties['options'] = $options; - } - else - { - throw new ezcBaseValueException( "options", $options, "instance of ezcConsoleProgressbarOptions" ); - } - } - - /** - * Returns the current options. - * Returns the options currently set for this progressbar. - * - * @return ezcConsoleProgressbarOptions The current options. - */ - public function getOptions() - { - return $this->properties['options']; - } - - /** - * Property read access. - * - * @param string $key Name of the property. - * @return mixed Value of the property or null. - * - * @throws ezcBasePropertyNotFoundException - * If the the desired property is not found. - * @ignore - */ - public function __get( $key ) - { - switch ( $key ) - { - case 'options': - return $this->properties['options']; - case 'step': - // Step is now an option - return $this->properties['options']->step; - case 'max': - return $this->properties[$key]; - default: - break; - } - throw new ezcBasePropertyNotFoundException( $key ); - } - - /** - * Property write access. - * - * @param string $key Name of the property. - * @param mixed $val The value for the property. - * - * @throws ezcBasePropertyNotFoundException - * If a desired property could not be found. - * @throws ezcBaseValueException - * If a desired property value is out of range. - * @ignore - */ - public function __set( $key, $val ) - { - switch ( $key ) - { - case 'options': - if ( !( $val instanceof ezcConsoleProgressbarOptions ) ) - { - throw new ezcBaseValueException( 'options', $val, 'instance of ezcConsoleProgressbarOptions' ); - }; - break; - case 'max': - if ( ( !is_int( $val ) && !is_float( $val ) ) || $val < 0 ) - { - throw new ezcBaseValueException( $key, $val, 'number >= 0' ); - } - break; - case 'step': - if ( ( !is_int( $val ) && !is_float( $val ) ) || $val < 0 ) - { - throw new ezcBaseValueException( $key, $val, 'number >= 0' ); - } - // Step is now an option. - $this->properties['options']->step = $val; - return; - default: - throw new ezcBasePropertyNotFoundException( $key ); - break; - } - // Changes settings or options, need for recalculating measures - $this->started = false; - $this->properties[$key] = $val; - } - - /** - * Property isset access. - * - * @param string $key Name of the property. - * @return bool True is the property is set, otherwise false. - * @ignore - */ - public function __isset( $key ) - { - switch ( $key ) - { - case 'options': - case 'max': - case 'step': - return true; - } - return false; - } - - /** - * Start the progress bar - * Starts the progress bar and sticks it to the current line. - * No output will be done yet. Call {@link ezcConsoleProgressbar::output()} - * to print the bar. - * - * @return void - */ - public function start() - { - $this->calculateMeasures(); - $this->output->storePos(); - $this->started = true; - } - - /** - * Draw the progress bar. - * Prints the progress-bar to the screen. If start() has not been called - * yet, the current line is used for {@link ezcConsolProgressbar::start()}. - * - * @return void - */ - public function output() - { - if ( $this->started === false ) - { - $this->start(); - } - $this->output->restorePos(); - $this->generateValues(); - echo $this->insertValues(); - } - - /** - * Advance the progress bar. - * Advances the progress bar by $step steps. Redraws the bar by default, - * using the {@link ezcConsoleProgressbar::output()} method. - * - * @param bool $redraw Whether to redraw the bar immediately. - * @param float $steps How far the progress bar should advance on this call. - * @return void - */ - public function advance( $redraw = true, $step = 1 ) - { - $this->currentStep += $step; - if ( $redraw === true && $this->currentStep % $this->properties['options']->redrawFrequency === 0 ) - { - $this->output(); - } - } - - /** - * Finish the progress bar. - * Finishes the bar (jump to 100% if not happened yet,...) and jumps - * to the next line to allow new output. Also resets the values of the - * output handler used, if changed. - * - * @return void - */ - public function finish() - { - $this->currentStep = $this->numSteps; - $this->output(); - } - - /** - * Generate all values to be replaced in the format string. - * - * @return void - */ - protected function generateValues() - { - // Bar - $barFilledSpace = ceil( $this->measures['barSpace'] / $this->numSteps * $this->currentStep ); - // Sanitize value if it gets to large by rounding - $barFilledSpace = $barFilledSpace > $this->measures['barSpace'] ? $this->measures['barSpace'] : $barFilledSpace; - $bar = str_pad( - str_pad( - $this->properties['options']->progressChar, - $barFilledSpace, - $this->properties['options']->barChar, - STR_PAD_LEFT - ), - $this->measures['barSpace'], - $this->properties['options']->emptyChar, - STR_PAD_RIGHT - ); - $this->valueMap['bar'] = $bar; - - // Fraction - $fractionVal = sprintf( - $this->properties['options']->fractionFormat, - ( $fractionVal = ( $this->properties['options']->step * $this->currentStep ) / $this->max * 100 ) > 100 ? 100 : $fractionVal - ); - $this->valueMap['fraction'] = str_pad( - $fractionVal, - strlen( sprintf( $this->properties['options']->fractionFormat, 100 ) ), - ' ', - STR_PAD_LEFT - ); - - // Act / max - $actVal = sprintf( - $this->properties['options']->actFormat, - ( $actVal = $this->currentStep * $this->properties['options']->step ) > $this->max ? $this->max : $actVal - ); - $this->valueMap['act'] = str_pad( - $actVal, - strlen( sprintf( $this->properties['options']->actFormat, $this->max ) ), - ' ', - STR_PAD_LEFT - ); - $this->valueMap['max'] = sprintf( $this->properties['options']->maxFormat, $this->max ); - } - - /** - * Insert values into bar format string. - * - * @return void - */ - protected function insertValues() - { - $bar = $this->properties['options']->formatString; - foreach ( $this->valueMap as $name => $val ) - { - $bar = str_replace( "%{$name}%", $val, $bar ); - } - return $bar; - } - - /** - * Calculate several measures necessary to generate a bar. - * - * @return void - */ - protected function calculateMeasures() - { - // Calc number of steps bar goes through - $this->numSteps = ( int ) round( $this->max / $this->properties['options']->step ); - // Calculate measures - $this->measures['fixedCharSpace'] = strlen( $this->stripEscapeSequences( $this->insertValues() ) ); - if ( strpos( $this->properties['options']->formatString,'%max%' ) !== false ) - { - $this->measures['maxSpace'] = strlen( sprintf( $this->properties['options']->maxFormat, $this->max ) ); - - } - if ( strpos( $this->properties['options']->formatString, '%act%' ) !== false ) - { - $this->measures['actSpace'] = strlen( sprintf( $this->properties['options']->actFormat, $this->max ) ); - } - if ( strpos( $this->properties['options']->formatString, '%fraction%' ) !== false ) - { - $this->measures['fractionSpace'] = strlen( sprintf( $this->properties['options']->fractionFormat, 100 ) ); - } - $this->measures['barSpace'] = $this->properties['options']->width - array_sum( $this->measures ); - } - - /** - * Strip all escape sequences from a string to measure it's size correctly. - * - * @param mixed $str - * @return void - */ - protected function stripEscapeSequences( $str ) - { - return preg_replace( '/\033\[[0-9a-f;]*m/i', '', $str ); - } -} -?> + + * $out = new ezcConsoleOutput(); + * + * // Create progress bar itself + * $progress = new ezcConsoleProgressbar( $out, 100, array( 'step' => 5 ) ); + * + * $progress->options->emptyChar = '-'; + * $progress->options->progressChar = '#'; + * $progress->options->formatString = "Uploading file : %act%/%max% kb [%bar%]"; + * + * // Perform actions + * $i = 0; + * while ( $i++ < 20 ) + * { + * // Do whatever you want to indicate progress for + * usleep( mt_rand( 20000, 2000000 ) ); + * // Advance the progressbar by one step ( uploading 5k per run ) + * $progress->advance(); + * } + * + * // Finish progress bar and jump to next line. + * $progress->finish(); + * + * $out->outputText( "Successfully uploaded .\n", 'success' ); + * + * + * @property ezcConsoleProgressbarOptions $options + * Contains the options for this class. + * @property int $max + * The maximum progress value to reach. + * + * @package ConsoleTools + * @version 1.1.3 + * @mainclass + */ +class ezcConsoleProgressbar +{ + /** + * Container to hold the properties + * + * @var array(string=>mixed) + */ + protected $properties; + + /** + * Storage for actual values to be replaced in the format string. + * Actual values are stored here and will be inserted into the bar + * before printing it. + * + * @var array(string => string) + */ + protected $valueMap = array( + 'bar' => '', + 'fraction' => '', + 'act' => '', + 'max' => '', + ); + + /** + * Stores the bar utilization. + * + * This array saves how much space a specific part of the bar utilizes to not + * recalculate those on every step. + * + * @var array(string => int) + */ + protected $measures = array( + 'barSpace' => 0, + 'fractionSpace' => 0, + 'actSpace' => 0, + 'maxSpace' => 0, + 'fixedCharSpace' => 0, + ); + + /** + * The current step the progress bar should show. + * + * @var int + */ + protected $currentStep = 0; + + /** + * The maximum number of steps to go. + * Calculated once from the settings. + * + * @var int + */ + protected $numSteps = 0; + + /** + * The ezcConsoleOutput object to use. + * + * @var ezcConsoleOutput + */ + protected $output; + + /** + * Indicates if the starting point for the bar has been stored. + * Per default this is false to indicate that no start position has been + * stored, yet. + * + * @var bool + */ + protected $started = false; + + /** + * Creates a new progress bar. + * + * @param ezcConsoleOutput $outHandler Handler to utilize for output + * @param int $max Maximum value, where progressbar + * reaches 100%. + * @param array(string=>string) $options Options + * + * @see ezcConsoleProgressbar::$options + */ + public function __construct(ezcConsoleOutput $outHandler, $max, array $options = array()) + { + $this->output = $outHandler; + $this->__set('max', $max); + $this->properties['options'] = new ezcConsoleProgressbarOptions($options); + } + + /** + * Set new options. + * This method allows you to change the options of progressbar. + * + * @param ezcConsoleProgresbarOptions $options The options to set. + * + * @throws ezcBaseSettingNotFoundException + * If you tried to set a non-existent option value. + * @throws ezcBaseSettingValueException + * If the value is not valid for the desired option. + * @throws ezcBaseValueException + * If you submit neither an array nor an instance of + * ezcConsoleProgresbarOptions. + */ + public function setOptions($options) + { + if (is_array($options)) { + $this->properties['options']->merge($options); + } elseif ($options instanceof ezcConsoleProgressbarOptions) { + $this->properties['options'] = $options; + } else { + throw new ezcBaseValueException("options", $options, "instance of ezcConsoleProgressbarOptions"); + } + } + + /** + * Returns the current options. + * Returns the options currently set for this progressbar. + * + * @return ezcConsoleProgressbarOptions The current options. + */ + public function getOptions() + { + return $this->properties['options']; + } + + /** + * Property read access. + * + * @param string $key Name of the property. + * @return mixed Value of the property or null. + * + * @throws ezcBasePropertyNotFoundException + * If the the desired property is not found. + * @ignore + */ + public function __get($key) + { + switch ($key) { + case 'options': + return $this->properties['options']; + case 'step': + // Step is now an option + return $this->properties['options']->step; + case 'max': + return $this->properties[$key]; + default: + break; + } + throw new ezcBasePropertyNotFoundException($key); + } + + /** + * Property write access. + * + * @param string $key Name of the property. + * @param mixed $val The value for the property. + * + * @throws ezcBasePropertyNotFoundException + * If a desired property could not be found. + * @throws ezcBaseValueException + * If a desired property value is out of range. + * @ignore + */ + public function __set($key, $val) + { + switch ($key) { + case 'options': + if (!( $val instanceof ezcConsoleProgressbarOptions )) { + throw new ezcBaseValueException('options', $val, 'instance of ezcConsoleProgressbarOptions'); + }; + break; + case 'max': + if (( !is_int($val) && !is_float($val) ) || $val < 0) { + throw new ezcBaseValueException($key, $val, 'number >= 0'); + } + break; + case 'step': + if (( !is_int($val) && !is_float($val) ) || $val < 0) { + throw new ezcBaseValueException($key, $val, 'number >= 0'); + } + // Step is now an option. + $this->properties['options']->step = $val; + return; + default: + throw new ezcBasePropertyNotFoundException($key); + break; + } + // Changes settings or options, need for recalculating measures + $this->started = false; + $this->properties[$key] = $val; + } + + /** + * Property isset access. + * + * @param string $key Name of the property. + * @return bool True is the property is set, otherwise false. + * @ignore + */ + public function __isset($key) + { + switch ($key) { + case 'options': + case 'max': + case 'step': + return true; + } + return false; + } + + /** + * Start the progress bar + * Starts the progress bar and sticks it to the current line. + * No output will be done yet. Call {@link ezcConsoleProgressbar::output()} + * to print the bar. + * + * @return void + */ + public function start() + { + $this->calculateMeasures(); + $this->output->storePos(); + $this->started = true; + } + + /** + * Draw the progress bar. + * Prints the progress-bar to the screen. If start() has not been called + * yet, the current line is used for {@link ezcConsolProgressbar::start()}. + * + * @return void + */ + public function output() + { + if ($this->started === false) { + $this->start(); + } + $this->output->restorePos(); + $this->generateValues(); + echo $this->insertValues(); + } + + /** + * Advance the progress bar. + * Advances the progress bar by $step steps. Redraws the bar by default, + * using the {@link ezcConsoleProgressbar::output()} method. + * + * @param bool $redraw Whether to redraw the bar immediately. + * @param float $steps How far the progress bar should advance on this call. + * @return void + */ + public function advance($redraw = true, $step = 1) + { + $this->currentStep += $step; + if ($redraw === true && $this->currentStep % $this->properties['options']->redrawFrequency === 0) { + $this->output(); + } + } + + /** + * Finish the progress bar. + * Finishes the bar (jump to 100% if not happened yet,...) and jumps + * to the next line to allow new output. Also resets the values of the + * output handler used, if changed. + * + * @return void + */ + public function finish() + { + $this->currentStep = $this->numSteps; + $this->output(); + } + + /** + * Generate all values to be replaced in the format string. + * + * @return void + */ + protected function generateValues() + { + // Bar + $barFilledSpace = ceil($this->measures['barSpace'] / $this->numSteps * $this->currentStep); + // Sanitize value if it gets to large by rounding + $barFilledSpace = $barFilledSpace > $this->measures['barSpace'] ? $this->measures['barSpace'] : $barFilledSpace; + $bar = str_pad( + str_pad( + $this->properties['options']->progressChar, + $barFilledSpace, + $this->properties['options']->barChar, + STR_PAD_LEFT + ), + $this->measures['barSpace'], + $this->properties['options']->emptyChar, + STR_PAD_RIGHT + ); + $this->valueMap['bar'] = $bar; + + // Fraction + $fractionVal = sprintf( + $this->properties['options']->fractionFormat, + ( $fractionVal = ( $this->properties['options']->step * $this->currentStep ) / $this->max * 100 ) > 100 ? 100 : $fractionVal + ); + $this->valueMap['fraction'] = str_pad( + $fractionVal, + strlen(sprintf($this->properties['options']->fractionFormat, 100)), + ' ', + STR_PAD_LEFT + ); + + // Act / max + $actVal = sprintf( + $this->properties['options']->actFormat, + ( $actVal = $this->currentStep * $this->properties['options']->step ) > $this->max ? $this->max : $actVal + ); + $this->valueMap['act'] = str_pad( + $actVal, + strlen(sprintf($this->properties['options']->actFormat, $this->max)), + ' ', + STR_PAD_LEFT + ); + $this->valueMap['max'] = sprintf($this->properties['options']->maxFormat, $this->max); + } + + /** + * Insert values into bar format string. + * + * @return void + */ + protected function insertValues() + { + $bar = $this->properties['options']->formatString; + foreach ($this->valueMap as $name => $val) { + $bar = str_replace("%{$name}%", $val, $bar); + } + return $bar; + } + + /** + * Calculate several measures necessary to generate a bar. + * + * @return void + */ + protected function calculateMeasures() + { + // Calc number of steps bar goes through + $this->numSteps = ( int ) round($this->max / $this->properties['options']->step); + // Calculate measures + $this->measures['fixedCharSpace'] = strlen($this->stripEscapeSequences($this->insertValues())); + if (strpos($this->properties['options']->formatString, '%max%') !== false) { + $this->measures['maxSpace'] = strlen(sprintf($this->properties['options']->maxFormat, $this->max)); + } + if (strpos($this->properties['options']->formatString, '%act%') !== false) { + $this->measures['actSpace'] = strlen(sprintf($this->properties['options']->actFormat, $this->max)); + } + if (strpos($this->properties['options']->formatString, '%fraction%') !== false) { + $this->measures['fractionSpace'] = strlen(sprintf($this->properties['options']->fractionFormat, 100)); + } + $this->measures['barSpace'] = $this->properties['options']->width - array_sum($this->measures); + } + + /** + * Strip all escape sequences from a string to measure it's size correctly. + * + * @param mixed $str + * @return void + */ + protected function stripEscapeSequences($str) + { + return preg_replace('/\033\[[0-9a-f;]*m/i', '', $str); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/progressmonitor.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/progressmonitor.php index 272f4be4dce17a0e20dc5336b42ddbe4da88b0d5..2567cf82cfdffcb3f08e60ea55bcb346cf927a04 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/progressmonitor.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/progressmonitor.php @@ -1,209 +1,199 @@ - - * // Construction - * $status = new ezcConsoleProgressMonitor( new ezcConsoleOutput(), 42 ); - * - * // Run statusbar - * foreach ( $files as $file ) - * { - * $res = $file->upload(); - * // Add a status-entry to be printed. - * $status->addEntry( 'UPLOAD', $file->path ); - * // Result like " 2.5% UPLOAD /var/upload/test.png" - * } - * - * - * - * @package ConsoleTools - * @version 1.1.3 - * @mainclass - */ -class ezcConsoleProgressMonitor -{ - /** - * Options - * - * @var ezcConsoleProgressMonitorOptions - */ - protected $options; - - /** - * The ezcConsoleOutput object to use. - * - * @var ezcConsoleOutput - */ - protected $outputHandler; - - /** - * Counter for the items already printed. - * - * @var int - */ - protected $counter = 0; - - /** - * The number of entries to expect. - * - * @var int - */ - protected $max; - - /** - * Creates a new progress monitor. - * - * @param ezcConsoleOutput $outHandler Handler to utilize for output - * @param int $max Number of items to expect - * @param array(string=>string) Options. - * - * @see ezcConsoleProgressMonitor::$options - */ - public function __construct( ezcConsoleOutput $outHandler, $max, array $options = array() ) - { - $this->outputHandler = $outHandler; - $this->max = $max; - $this->options = new ezcConsoleProgressMonitorOptions( $options ); - } - - /** - * Property read access. - * - * @param string $key Name of the property. - * @return mixed Value of the property or null. - * - * @throws ezcBasePropertyNotFoundException - * If the the desired property is not found. - */ - public function __get( $key ) - { - switch ( $key ) - { - case 'options': - return $this->options; - break; - } - throw new ezcBasePropertyNotFoundException( $key ); - } - - /** - * Property write access. - * - * @param string $propertyName Name of the property. - * @param mixed $val The value for the property. - * - * @throws ezcBaseValueException - * If a the value for the property options is not an instance of - * ezcConsoleProgressMonitorOptions. - * @return void - */ - public function __set( $propertyName, $val ) - { - switch ( $propertyName ) - { - case 'options': - if ( !( $val instanceof ezcConsoleProgressMonitorOptions ) ) - { - throw new ezcBaseValueException( $key, $val, 'instance of ezcConsoleProgressMonitorOptions' ); - } - $this->options = $val; - return; - } - throw new ezcBasePropertyNotFoundException( $propertyName ); - } - - - /** - * Property isset access. - * - * @param string $propertyName Name of the property. - * @return bool True is the property is set, otherwise false. - */ - public function __isset( $propertyName ) - { - switch ( $propertyName ) - { - case 'options': - return true; - } - return false; - } - - /** - * Set new options. - * This method allows you to change the options of an progress monitor. - * - * @param ezcConsoleProgressMonitorOptions $options The options to set. - * - * @throws ezcBaseSettingNotFoundException - * If you tried to set a non-existent option value. - * @throws ezcBaseSettingValueException - * If the value is not valid for the desired option. - * @throws ezcBaseValueException - * If you submit neither an array nor an instance of - * ezcConsoleProgressMonitorOptions. - */ - public function setOptions( $options ) - { - if ( is_array( $options ) ) - { - $this->options->merge( $options ); - } - else if ( $options instanceof ezcConsoleProgressMonitorOptions ) - { - $this->options = $options; - } - else - { - throw new ezcBaseValueException( "options", $options, "instance of ezcConsoleProgressMonitorOptions" ); - } - } - - /** - * Returns the currently set options. - * Returns the currently set option array. - * - * @return ezcConsoleProgressMonitorOptions The options. - */ - public function getOptions() - { - return $this->options; - } - - /** - * Print a status entry. - * Prints a new status entry to the console and updates the internal counter. - * - * @param string $tag The tag to print (second argument in the - * formatString). - * @param string $data The data to be printed in the status entry (third - * argument in the format string). - * @return void - */ - public function addEntry( $tag, $data ) - { - $this->counter++; - $percentage = $this->counter / $this->max * 100; - - $this->outputHandler->outputLine( - sprintf( - $this->options['formatString'], - $percentage, - $tag, - $data - ) - ); - } -} -?> + + * // Construction + * $status = new ezcConsoleProgressMonitor( new ezcConsoleOutput(), 42 ); + * + * // Run statusbar + * foreach ( $files as $file ) + * { + * $res = $file->upload(); + * // Add a status-entry to be printed. + * $status->addEntry( 'UPLOAD', $file->path ); + * // Result like " 2.5% UPLOAD /var/upload/test.png" + * } + * + * + * + * @package ConsoleTools + * @version 1.1.3 + * @mainclass + */ +class ezcConsoleProgressMonitor +{ + /** + * Options + * + * @var ezcConsoleProgressMonitorOptions + */ + protected $options; + + /** + * The ezcConsoleOutput object to use. + * + * @var ezcConsoleOutput + */ + protected $outputHandler; + + /** + * Counter for the items already printed. + * + * @var int + */ + protected $counter = 0; + + /** + * The number of entries to expect. + * + * @var int + */ + protected $max; + + /** + * Creates a new progress monitor. + * + * @param ezcConsoleOutput $outHandler Handler to utilize for output + * @param int $max Number of items to expect + * @param array(string=>string) Options. + * + * @see ezcConsoleProgressMonitor::$options + */ + public function __construct(ezcConsoleOutput $outHandler, $max, array $options = array()) + { + $this->outputHandler = $outHandler; + $this->max = $max; + $this->options = new ezcConsoleProgressMonitorOptions($options); + } + + /** + * Property read access. + * + * @param string $key Name of the property. + * @return mixed Value of the property or null. + * + * @throws ezcBasePropertyNotFoundException + * If the the desired property is not found. + */ + public function __get($key) + { + switch ($key) { + case 'options': + return $this->options; + break; + } + throw new ezcBasePropertyNotFoundException($key); + } + + /** + * Property write access. + * + * @param string $propertyName Name of the property. + * @param mixed $val The value for the property. + * + * @throws ezcBaseValueException + * If a the value for the property options is not an instance of + * ezcConsoleProgressMonitorOptions. + * @return void + */ + public function __set($propertyName, $val) + { + switch ($propertyName) { + case 'options': + if (!( $val instanceof ezcConsoleProgressMonitorOptions )) { + throw new ezcBaseValueException($key, $val, 'instance of ezcConsoleProgressMonitorOptions'); + } + $this->options = $val; + return; + } + throw new ezcBasePropertyNotFoundException($propertyName); + } + + + /** + * Property isset access. + * + * @param string $propertyName Name of the property. + * @return bool True is the property is set, otherwise false. + */ + public function __isset($propertyName) + { + switch ($propertyName) { + case 'options': + return true; + } + return false; + } + + /** + * Set new options. + * This method allows you to change the options of an progress monitor. + * + * @param ezcConsoleProgressMonitorOptions $options The options to set. + * + * @throws ezcBaseSettingNotFoundException + * If you tried to set a non-existent option value. + * @throws ezcBaseSettingValueException + * If the value is not valid for the desired option. + * @throws ezcBaseValueException + * If you submit neither an array nor an instance of + * ezcConsoleProgressMonitorOptions. + */ + public function setOptions($options) + { + if (is_array($options)) { + $this->options->merge($options); + } elseif ($options instanceof ezcConsoleProgressMonitorOptions) { + $this->options = $options; + } else { + throw new ezcBaseValueException("options", $options, "instance of ezcConsoleProgressMonitorOptions"); + } + } + + /** + * Returns the currently set options. + * Returns the currently set option array. + * + * @return ezcConsoleProgressMonitorOptions The options. + */ + public function getOptions() + { + return $this->options; + } + + /** + * Print a status entry. + * Prints a new status entry to the console and updates the internal counter. + * + * @param string $tag The tag to print (second argument in the + * formatString). + * @param string $data The data to be printed in the status entry (third + * argument in the format string). + * @return void + */ + public function addEntry($tag, $data) + { + $this->counter++; + $percentage = $this->counter / $this->max * 100; + + $this->outputHandler->outputLine( + sprintf( + $this->options['formatString'], + $percentage, + $tag, + $data + ) + ); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/statusbar.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/statusbar.php index 8edfff02cfbb4667f63f3e5dd06ad27bc7f28d86..60a21a559582fcd6ea9fd15e74c17e0209f598c4 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/statusbar.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/statusbar.php @@ -1,255 +1,243 @@ - - * // Construction - * $status = new ezcConsoleStatusbar( new ezcConsoleOutput() ); - * - * // Set option - * $status->options['successChar'] = '*'; - * - * // Run statusbar - * foreach ( $files as $file ) - * { - * $res = $file->upload(); - * // Add status if form of bool true/false to statusbar. - * $status->add( $res ); // $res is true or false - * } - * - * // Retreive and display final statusbar results - * $msg = $status->getSuccess() . ' succeeded, ' . $status->getFailure() . ' failed.'; - * $out->outputText( "Finished uploading files: $msg\n" ); - * - * - * @property ezcConsoleStatusbarOptions $options - * Contains the options for this class. - * - * @package ConsoleTools - * @version 1.1.3 - * @mainclass - */ -class ezcConsoleStatusbar -{ - /** - * Container to hold the properties - * - * @var array(string=>mixed) - */ - protected $properties; - - /** - * The ezcConsoleOutput object to use. - * - * @var ezcConsoleOutput - */ - protected $outputHandler; - - /** - * Counter for success and failure outputs. - * - * @var array(bool=>int) - */ - protected $counter = array( - true => 0, - false => 0, - ); - - /** - * Creates a new status bar. - * - * @param ezcConsoleOutput $outHandler Handler to utilize for output - * @param array(string=>string) $options Options - * - * @see ezcConsoleStatusbar::$options - */ - public function __construct( ezcConsoleOutput $outHandler, array $options = array() ) - { - $this->outputHandler = $outHandler; - $this->properties['options'] = new ezcConsoleStatusbarOptions( $options ); - } - - /** - * Property read access. - * - * @param string $key Name of the property. - * @return mixed Value of the property or null. - * - * @throws ezcBasePropertyNotFoundException - * If the the desired property is not found. - * @ignore - */ - public function __get( $key ) - { - switch ( $key ) - { - case 'options': - return $this->properties['options']; - break; - } - if ( isset( $this->properties['options']->$key ) ) - { - return $this->properties['options']->$key; - } - throw new ezcBasePropertyNotFoundException( $key ); - } - - /** - * Set new options. - * This method allows you to change the options of a statusbar. - * - * @param array(string=>string)|ezcConsoleOutputOptions $options The options to set. - * - * @throws ezcBaseSettingNotFoundException - * If you tried to set a non-existent option value. - * @throws ezcBaseSettingValueException - * If the value is not valid for the desired option. - * @throws ezcBaseValueException - * If you submit neither an array nor an instance of - * ezcConsoleOutputOptions. - */ - public function setOptions( $options ) - { - if ( is_array( $options ) ) - { - $this->properties['options']->merge( $options ); - } - else if ( $options instanceof ezcConsoleStatusbarOptions ) - { - $this->properties['options'] = $options; - } - else - { - throw new ezcBaseValueException( "options", $options, "instance of ezcConsoleStatusbarOptions" ); - } - } - - /** - * Property write access. - * - * @param string $key Name of the property. - * @param mixed $val The value for the property. - * - * @throws ezcBasePropertyNotFoundException - * If a desired property could not be found. - * @throws ezcBaseValueException - * If a desired property value is out of range. - * @ignore - */ - public function __set( $key, $val ) - { - switch ( $key ) - { - // Those two are here for BC reasons only, it is proper to - // use $statusbar->options->successChar instead of just - // $statusbar->successChar. - case 'successChar': - case 'failureChar': - if ( strlen( $val ) < 1 ) - { - throw new ezcBaseValueException( $key, $val, 'string, not empty' ); - } - break; - default: - throw new ezcBasePropertyNotFoundException( $key ); - } - $this->properties['options'][$key] = $val; - } - - /** - * Property isset access. - * - * @param string $key Name of the property. - * @return bool True is the property is set, otherwise false. - * @ignore - */ - public function __isset( $key ) - { - return isset( $this->properties['options'][$key] ); - } - - /** - * Returns the current options. - * Returns the options currently set for this progressbar. - * - * @return ezcConsoleStatusbarOptions The current options. - */ - public function getOptions() - { - return $this->properties['options']; - } - - /** - * Add a status to the status bar. - * Adds a new status to the bar which is printed immediately. If the - * cursor is currently not at the beginning of a line, it will move to - * the next line. - * - * @param bool $status Print successChar on true, failureChar on false. - * @return void - */ - public function add( $status ) - { - switch ( $status ) - { - case true: - $this->outputHandler->outputText( $this->properties['options']['successChar'], 'success' ); - break; - - case false: - $this->outputHandler->outputText( $this->properties['options']['failureChar'], 'failure' ); - break; - - default: - trigger_error( 'Unknown status '.var_export( $status, true ).'.', E_USER_WARNING ); - return; - } - $this->counter[$status]++; - } - - /** - * Reset the state of the status-bar object to its initial one. - * - * @return void - */ - public function reset() - { - foreach ( $this->counter as $status => $count ) - { - $this->counter[$status] = 0; - } - } - - /** - * Returns number of successes during the run. - * Returns the number of success characters printed from this status bar. - * - * @return int Number of successes. - */ - public function getSuccessCount() - { - return $this->counter[true]; - } - - /** - * Returns number of failures during the run. - * Returns the number of failure characters printed from this status bar. - * - * @return int Number of failures. - */ - public function getFailureCount() - { - return $this->counter[false]; - } -} -?> + + * // Construction + * $status = new ezcConsoleStatusbar( new ezcConsoleOutput() ); + * + * // Set option + * $status->options['successChar'] = '*'; + * + * // Run statusbar + * foreach ( $files as $file ) + * { + * $res = $file->upload(); + * // Add status if form of bool true/false to statusbar. + * $status->add( $res ); // $res is true or false + * } + * + * // Retreive and display final statusbar results + * $msg = $status->getSuccess() . ' succeeded, ' . $status->getFailure() . ' failed.'; + * $out->outputText( "Finished uploading files: $msg\n" ); + * + * + * @property ezcConsoleStatusbarOptions $options + * Contains the options for this class. + * + * @package ConsoleTools + * @version 1.1.3 + * @mainclass + */ +class ezcConsoleStatusbar +{ + /** + * Container to hold the properties + * + * @var array(string=>mixed) + */ + protected $properties; + + /** + * The ezcConsoleOutput object to use. + * + * @var ezcConsoleOutput + */ + protected $outputHandler; + + /** + * Counter for success and failure outputs. + * + * @var array(bool=>int) + */ + protected $counter = array( + true => 0, + false => 0, + ); + + /** + * Creates a new status bar. + * + * @param ezcConsoleOutput $outHandler Handler to utilize for output + * @param array(string=>string) $options Options + * + * @see ezcConsoleStatusbar::$options + */ + public function __construct(ezcConsoleOutput $outHandler, array $options = array()) + { + $this->outputHandler = $outHandler; + $this->properties['options'] = new ezcConsoleStatusbarOptions($options); + } + + /** + * Property read access. + * + * @param string $key Name of the property. + * @return mixed Value of the property or null. + * + * @throws ezcBasePropertyNotFoundException + * If the the desired property is not found. + * @ignore + */ + public function __get($key) + { + switch ($key) { + case 'options': + return $this->properties['options']; + break; + } + if (isset($this->properties['options']->$key)) { + return $this->properties['options']->$key; + } + throw new ezcBasePropertyNotFoundException($key); + } + + /** + * Set new options. + * This method allows you to change the options of a statusbar. + * + * @param array(string=>string)|ezcConsoleOutputOptions $options The options to set. + * + * @throws ezcBaseSettingNotFoundException + * If you tried to set a non-existent option value. + * @throws ezcBaseSettingValueException + * If the value is not valid for the desired option. + * @throws ezcBaseValueException + * If you submit neither an array nor an instance of + * ezcConsoleOutputOptions. + */ + public function setOptions($options) + { + if (is_array($options)) { + $this->properties['options']->merge($options); + } elseif ($options instanceof ezcConsoleStatusbarOptions) { + $this->properties['options'] = $options; + } else { + throw new ezcBaseValueException("options", $options, "instance of ezcConsoleStatusbarOptions"); + } + } + + /** + * Property write access. + * + * @param string $key Name of the property. + * @param mixed $val The value for the property. + * + * @throws ezcBasePropertyNotFoundException + * If a desired property could not be found. + * @throws ezcBaseValueException + * If a desired property value is out of range. + * @ignore + */ + public function __set($key, $val) + { + switch ($key) { + // Those two are here for BC reasons only, it is proper to + // use $statusbar->options->successChar instead of just + // $statusbar->successChar. + case 'successChar': + case 'failureChar': + if (strlen($val) < 1) { + throw new ezcBaseValueException($key, $val, 'string, not empty'); + } + break; + default: + throw new ezcBasePropertyNotFoundException($key); + } + $this->properties['options'][$key] = $val; + } + + /** + * Property isset access. + * + * @param string $key Name of the property. + * @return bool True is the property is set, otherwise false. + * @ignore + */ + public function __isset($key) + { + return isset($this->properties['options'][$key]); + } + + /** + * Returns the current options. + * Returns the options currently set for this progressbar. + * + * @return ezcConsoleStatusbarOptions The current options. + */ + public function getOptions() + { + return $this->properties['options']; + } + + /** + * Add a status to the status bar. + * Adds a new status to the bar which is printed immediately. If the + * cursor is currently not at the beginning of a line, it will move to + * the next line. + * + * @param bool $status Print successChar on true, failureChar on false. + * @return void + */ + public function add($status) + { + switch ($status) { + case true: + $this->outputHandler->outputText($this->properties['options']['successChar'], 'success'); + break; + + case false: + $this->outputHandler->outputText($this->properties['options']['failureChar'], 'failure'); + break; + + default: + trigger_error('Unknown status '.var_export($status, true).'.', E_USER_WARNING); + return; + } + $this->counter[$status]++; + } + + /** + * Reset the state of the status-bar object to its initial one. + * + * @return void + */ + public function reset() + { + foreach ($this->counter as $status => $count) { + $this->counter[$status] = 0; + } + } + + /** + * Returns number of successes during the run. + * Returns the number of success characters printed from this status bar. + * + * @return int Number of successes. + */ + public function getSuccessCount() + { + return $this->counter[true]; + } + + /** + * Returns number of failures during the run. + * Returns the number of failure characters printed from this status bar. + * + * @return int Number of failures. + */ + public function getFailureCount() + { + return $this->counter[false]; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/structs/option_rule.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/structs/option_rule.php index f4822a7137f60f21b09da5b34b239635e2e5a526..bf7053759be00c04463b9f1f3aa12e55dfabf3b4 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/structs/option_rule.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/structs/option_rule.php @@ -1,144 +1,136 @@ -option ezcConsoleOption, contains the parameter that this rule refers to. - * - values array(string), contains a list of values that are accepted. - * - * @see ezcConsoleOption - * - * @package ConsoleTools - * @version 1.1.3 - */ -class ezcConsoleOptionRule -{ - /** - * Property array containing this class' properties. - * - * @var array - */ - protected $properties = array( - 'option' => null, - 'values' => array(), - ); - - /** - * Creates a new parameter rule. - * - * Creates a new parameter rule. Per default the $values parameter - * is an empty array, which determines that the parameter may accept any - * value. To indicate that a parameter may only have certain values, - * place them inside tha $values array. For example to indicate a parameter - * may have the values 'a', 'b' and 'c' use: - * - * $rule = new ezcConsoleOptionRule( $option, array( 'a', 'b', 'c' ) ); - * - * If you want to allow only 1 specific value for a parameter, you do not - * need to wrap this into an array, when creating the rule. Simply use - * - * $rule = new ezcConsoleOptionRule( $option, 'a' ); - * - * to create a rule, that allows the desired parameter only to accept the - * value 'a'. - * - * @param ezcConsoleOption $option The parameter to refer to. - * @param mixed $values The values $option may have assigned. - */ - public function __construct( ezcConsoleOption $option, array $values = array() ) - { - $this->__set( 'option', $option ); - $this->__set( 'values', $values ); - } - - /** - * Property read access overloading. - * Gain read access to properties. - * - * @throws ezcBasePropertyNotFoundException - * If the property tried to access does not exist. - * - * @param string $propertyName Name of the property to access. - * @return mixed Value of the property. - */ - public function __get( $propertyName ) - { - switch ( $propertyName ) - { - case 'option': - return $this->properties['option']; - case 'values': - return $this->properties['values']; - } - throw new ezcBasePropertyNotFoundException( $propertyName ); - } - - /** - * Property read access overloading. - * Gain read access to properties. - * - * @throws ezcBasePropertyNotFoundException - * If the property tried to access does not exist. - * @throws ezcBaseValueException - * If the value for a property is not in the correct range. - * - * @param string $propertyName Name of the property to access. - * @return void - */ - public function __set( $propertyName, $val ) - { - switch ( $propertyName ) - { - case 'option': - if ( !( $val instanceof ezcConsoleOption ) ) - { - throw new ezcBaseValueException( $propertyName, $val, 'ezcConsoleOption' ); - } - $this->properties['option'] = $val; - return; - case 'values': - if ( !is_array( $val ) ) - { - throw new ezcBaseValueException( $propertyName, $val, 'array' ); - } - $this->properties['values'] = $val; - return; - } - throw new ezcBasePropertyNotFoundException( $propertyName ); - } - - /** - * Property isset access. - * - * @param string $propertyName Name of the property. - * @return bool True is the property is set, otherwise false. - */ - public function __isset( $propertyName ) - { - switch ( $propertyName ) - { - case 'option': - case 'values': - return true; - } - return false; - } - -} - -?> +option ezcConsoleOption, contains the parameter that this rule refers to. + * - values array(string), contains a list of values that are accepted. + * + * @see ezcConsoleOption + * + * @package ConsoleTools + * @version 1.1.3 + */ +class ezcConsoleOptionRule +{ + /** + * Property array containing this class' properties. + * + * @var array + */ + protected $properties = array( + 'option' => null, + 'values' => array(), + ); + + /** + * Creates a new parameter rule. + * + * Creates a new parameter rule. Per default the $values parameter + * is an empty array, which determines that the parameter may accept any + * value. To indicate that a parameter may only have certain values, + * place them inside tha $values array. For example to indicate a parameter + * may have the values 'a', 'b' and 'c' use: + * + * $rule = new ezcConsoleOptionRule( $option, array( 'a', 'b', 'c' ) ); + * + * If you want to allow only 1 specific value for a parameter, you do not + * need to wrap this into an array, when creating the rule. Simply use + * + * $rule = new ezcConsoleOptionRule( $option, 'a' ); + * + * to create a rule, that allows the desired parameter only to accept the + * value 'a'. + * + * @param ezcConsoleOption $option The parameter to refer to. + * @param mixed $values The values $option may have assigned. + */ + public function __construct(ezcConsoleOption $option, array $values = array()) + { + $this->__set('option', $option); + $this->__set('values', $values); + } + + /** + * Property read access overloading. + * Gain read access to properties. + * + * @throws ezcBasePropertyNotFoundException + * If the property tried to access does not exist. + * + * @param string $propertyName Name of the property to access. + * @return mixed Value of the property. + */ + public function __get($propertyName) + { + switch ($propertyName) { + case 'option': + return $this->properties['option']; + case 'values': + return $this->properties['values']; + } + throw new ezcBasePropertyNotFoundException($propertyName); + } + + /** + * Property read access overloading. + * Gain read access to properties. + * + * @throws ezcBasePropertyNotFoundException + * If the property tried to access does not exist. + * @throws ezcBaseValueException + * If the value for a property is not in the correct range. + * + * @param string $propertyName Name of the property to access. + * @return void + */ + public function __set($propertyName, $val) + { + switch ($propertyName) { + case 'option': + if (!( $val instanceof ezcConsoleOption )) { + throw new ezcBaseValueException($propertyName, $val, 'ezcConsoleOption'); + } + $this->properties['option'] = $val; + return; + case 'values': + if (!is_array($val)) { + throw new ezcBaseValueException($propertyName, $val, 'array'); + } + $this->properties['values'] = $val; + return; + } + throw new ezcBasePropertyNotFoundException($propertyName); + } + + /** + * Property isset access. + * + * @param string $propertyName Name of the property. + * @return bool True is the property is set, otherwise false. + */ + public function __isset($propertyName) + { + switch ($propertyName) { + case 'option': + case 'values': + return true; + } + return false; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/structs/output_format.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/structs/output_format.php index cae01b19bcccb1227c7c195d3538fcb2052f92ab..800e21e43a72eeca7719393096c6d9ef7f1eaa65 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/structs/output_format.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/structs/output_format.php @@ -1,177 +1,170 @@ -mixed) - */ - protected $properties = array( - 'color' => 'default', - 'style' => array( 'default' ), - 'bgcolor' => 'default', - ); - - /** - * Create a new ezcConsoleOutputFormat object. - * Creates a new object of this class. - * - * @param string $color Name of a color value. - * @param array(int=>string) $style Names of style values. - * @param string $bgcolor Name of a bgcolor value. - */ - public function __construct( $color = 'default', array $style = null, $bgcolor = 'default' ) - { - $this->__set( 'color', $color ); - $this->__set( 'style', isset( $style ) ? $style : array( 'default' ) ); - $this->__set( 'bgcolor', $bgcolor ); - } - - /** - * Overloaded __get() method to gain read-only access to some attributes. - * - * @param string $propertyName Name of the property to read. - * @return mixed Desired value if exists, otherwise null. - * @ignore - */ - public function __get( $propertyName ) - { - switch ( $propertyName ) - { - case 'style': - return (array) $this->properties[$propertyName]; - case 'color': - case 'bgcolor': - return $this->properties[$propertyName]; - default: - throw new ezcBasePropertyNotFoundException( $propertyName ); - } - } - - /** - * Overloaded __set() method to gain read-only access to properties. - * It also performs checks on setting others. - * - * @throws ezcBasePropertyNotFoundException - * If the setting you try to access does not exists - * @throws ezcBaseValueException - * If trying to set an invalid value for a setting. - * - * @param string $propertyName Name of the attrinbute to access. - * @param string $val The value to set. - * @ignore - */ - public function __set( $propertyName, $val ) - { - if ( !isset( $this->properties[$propertyName] ) ) - { - throw new ezcBasePropertyNotFoundException( $propertyName ); - } - // Extry handling of multi styles - if ( $propertyName === 'style' ) - { - if ( !is_array( $val ) ) $val = array( $val ); - foreach ( $val as $style ) - { - if ( !ezcConsoleOutput::isValidFormatCode( $propertyName, $style ) ) - { - throw new ezcBaseValueException( $propertyName, $style, 'valid ezcConsoleOutput format code' ); - } - } - $this->properties['style'] = $val; - return; - } - // Continue normal handling - if ( !ezcConsoleOutput::isValidFormatCode( $propertyName, $val ) ) - { - throw new ezcBaseValueException( $propertyName, $val, 'valid ezcConsoleOutput format code' ); - } - $this->properties[$propertyName] = $val; - } - - /** - * Property isset access. - * - * @param string $propertyName Name of the property. - * @return bool True is the property is set, otherwise false. - * @ignore - */ - public function __isset( $propertyName ) - { - return isset( $this->properties[$propertyName] ); - } - -} - -?> +mixed) + */ + protected $properties = array( + 'color' => 'default', + 'style' => array( 'default' ), + 'bgcolor' => 'default', + ); + + /** + * Create a new ezcConsoleOutputFormat object. + * Creates a new object of this class. + * + * @param string $color Name of a color value. + * @param array(int=>string) $style Names of style values. + * @param string $bgcolor Name of a bgcolor value. + */ + public function __construct($color = 'default', array $style = null, $bgcolor = 'default') + { + $this->__set('color', $color); + $this->__set('style', isset($style) ? $style : array( 'default' )); + $this->__set('bgcolor', $bgcolor); + } + + /** + * Overloaded __get() method to gain read-only access to some attributes. + * + * @param string $propertyName Name of the property to read. + * @return mixed Desired value if exists, otherwise null. + * @ignore + */ + public function __get($propertyName) + { + switch ($propertyName) { + case 'style': + return (array) $this->properties[$propertyName]; + case 'color': + case 'bgcolor': + return $this->properties[$propertyName]; + default: + throw new ezcBasePropertyNotFoundException($propertyName); + } + } + + /** + * Overloaded __set() method to gain read-only access to properties. + * It also performs checks on setting others. + * + * @throws ezcBasePropertyNotFoundException + * If the setting you try to access does not exists + * @throws ezcBaseValueException + * If trying to set an invalid value for a setting. + * + * @param string $propertyName Name of the attrinbute to access. + * @param string $val The value to set. + * @ignore + */ + public function __set($propertyName, $val) + { + if (!isset($this->properties[$propertyName])) { + throw new ezcBasePropertyNotFoundException($propertyName); + } + // Extry handling of multi styles + if ($propertyName === 'style') { + if (!is_array($val)) { + $val = array( $val ); + } + foreach ($val as $style) { + if (!ezcConsoleOutput::isValidFormatCode($propertyName, $style)) { + throw new ezcBaseValueException($propertyName, $style, 'valid ezcConsoleOutput format code'); + } + } + $this->properties['style'] = $val; + return; + } + // Continue normal handling + if (!ezcConsoleOutput::isValidFormatCode($propertyName, $val)) { + throw new ezcBaseValueException($propertyName, $val, 'valid ezcConsoleOutput format code'); + } + $this->properties[$propertyName] = $val; + } + + /** + * Property isset access. + * + * @param string $propertyName Name of the property. + * @return bool True is the property is set, otherwise false. + * @ignore + */ + public function __isset($propertyName) + { + return isset($this->properties[$propertyName]); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/structs/output_formats.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/structs/output_formats.php index 30f53635d54fbe1b23920f230f2f2d7771f282f1..09b8c573aa5955bc83f75f8bdaafc201b28befa4 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/structs/output_formats.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/structs/output_formats.php @@ -1,109 +1,105 @@ - - * // New ezcConsoleOutput - * // $output->format is instance of ezcConsoleOutputFormats. - * $output = new ezcConsoleOutput(); - * - * // Default format - color = blue - * $output->formats->default->color = 'blue'; - * // Default format - weight = bold - * $output->formats->default->style = array( 'bold' ); - * - * // New format "important" - color = red - * $output->formats->important->color = 'red'; - * // Format "important" - background color = black - * $output->formats->important->bgcolor = 'black'; - * - * - * @package ConsoleTools - * @version 1.1.3 - */ -class ezcConsoleOutputFormats -{ - /** - * Array of ezcConsoleOutputFormat. - * - * @var array(ezcConsoleOutputFormat) - */ - protected $formats = array(); - - /** - * Create a new ezcConsoleOutputFormats object. - * - * Creates a new, empty object of this class. It also adds a default - * format. - */ - public function __construct() - { - $this->formats['default'] = new ezcConsoleOutputFormat(); - $this->formats['success'] = new ezcConsoleOutputFormat(); - $this->formats['success']->color = 'green'; - $this->formats['success']->style = array( 'bold' ); - $this->formats['failure'] = new ezcConsoleOutputFormat(); - $this->formats['failure']->color = 'red'; - $this->formats['failure']->style = array( 'bold' ); - } - - /** - * Read access to the formats. - * - * Formats are accessed directly like properties of this object. If a - * format does not exist, it is created on the fly (using default values), - * - * @param string $formatName - * @return ezcConsoleOutputFormat The format. - */ - public function __get( $formatName ) - { - if ( !isset( $this->formats[$formatName] ) ) - { - $this->formats[$formatName] = new ezcConsoleOutputFormat(); - } - return $this->formats[$formatName]; - } - - /** - * Write access to the formats. - * - * Formats are accessed directly like properties of this object. If a - * format does not exist, it is created on the fly (using default values), - * - * @param string $formatName - * @param ezcConsoleOutputFormat $val The format defintion. - * @return void - */ - public function __set( $formatName, ezcConsoleOutputFormat $val ) - { - $this->formats[$formatName] = $val; - } - - /** - * Property isset access. - * - * @param string $formatName Name of the property. - * @return bool True is the property is set, otherwise false. - */ - public function __isset( $formatName ) - { - return isset( $this->formats[$formatName] ); - } - -} - -?> + + * // New ezcConsoleOutput + * // $output->format is instance of ezcConsoleOutputFormats. + * $output = new ezcConsoleOutput(); + * + * // Default format - color = blue + * $output->formats->default->color = 'blue'; + * // Default format - weight = bold + * $output->formats->default->style = array( 'bold' ); + * + * // New format "important" - color = red + * $output->formats->important->color = 'red'; + * // Format "important" - background color = black + * $output->formats->important->bgcolor = 'black'; + * + * + * @package ConsoleTools + * @version 1.1.3 + */ +class ezcConsoleOutputFormats +{ + /** + * Array of ezcConsoleOutputFormat. + * + * @var array(ezcConsoleOutputFormat) + */ + protected $formats = array(); + + /** + * Create a new ezcConsoleOutputFormats object. + * + * Creates a new, empty object of this class. It also adds a default + * format. + */ + public function __construct() + { + $this->formats['default'] = new ezcConsoleOutputFormat(); + $this->formats['success'] = new ezcConsoleOutputFormat(); + $this->formats['success']->color = 'green'; + $this->formats['success']->style = array( 'bold' ); + $this->formats['failure'] = new ezcConsoleOutputFormat(); + $this->formats['failure']->color = 'red'; + $this->formats['failure']->style = array( 'bold' ); + } + + /** + * Read access to the formats. + * + * Formats are accessed directly like properties of this object. If a + * format does not exist, it is created on the fly (using default values), + * + * @param string $formatName + * @return ezcConsoleOutputFormat The format. + */ + public function __get($formatName) + { + if (!isset($this->formats[$formatName])) { + $this->formats[$formatName] = new ezcConsoleOutputFormat(); + } + return $this->formats[$formatName]; + } + + /** + * Write access to the formats. + * + * Formats are accessed directly like properties of this object. If a + * format does not exist, it is created on the fly (using default values), + * + * @param string $formatName + * @param ezcConsoleOutputFormat $val The format defintion. + * @return void + */ + public function __set($formatName, ezcConsoleOutputFormat $val) + { + $this->formats[$formatName] = $val; + } + + /** + * Property isset access. + * + * @param string $formatName Name of the property. + * @return bool True is the property is set, otherwise false. + */ + public function __isset($formatName) + { + return isset($this->formats[$formatName]); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/table.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/table.php index 44697cc870576768fbfac347f2db32687755875f..e96039c5c6690a1f084513829e2a0deb08867a24 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/table.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/table.php @@ -1,781 +1,731 @@ -format. The second dimension gives - * you direct access to the cells of your table, like $table[0][0] accesses the - * first cell in the first row of your table. You can access its properties - * diretly here, too. This works like e.g. $table[0][0]->format. Table row and - * cell objects are created on the fly, when you access them for the first time. - * You can also create them as if you simply create new array elements. E.g. - * $table[] creates a new row in the table. - * - * - * // Initialize the console output handler - * $out = new ezcConsoleOutput(); - * // Define a new format "headline" - * $out->formats->headline->color = 'red'; - * $out->formats->headline->style = array( 'bold' ); - * // Define a new format "sum" - * $out->formats->sum->color = 'blue'; - * $out->formats->sum->style = array( 'negative' ); - * - * // Create a new table - * $table = new ezcConsoleTable( $out, 60 ); - * - * // Create first row and in it the first cell - * $table[0][0]->content = 'Headline 1'; - * - * // Create 3 more cells in row 0 - * for ( $i = 2; $i < 5; $i++ ) - * { - * $table[0][]->content = "Headline $i"; - * } - * - * $data = array( 1, 2, 3, 4 ); - * - * // Create some more data in the table... - * foreach ( $data as $value ) - * { - * // Create a new row each time and set it's contents to the actual value - * $table[][0]->content = $value; - * } - * - * // Set another border format for our headline row - * $table[0]->borderFormat = 'headline'; - * - * // Set the content format for all cells of the 3rd row to "sum" - * $table[2]->format = 'sum'; - * - * $table->outputTable(); - * - * - * @property ezcConsoleTableOptions $options - * Contains the options for this class. - * @property int $width - * Width of the table. - * - * @see ezcConsoleOutput - * @package ConsoleTools - * @version 1.1.3 - * @mainclass - */ -class ezcConsoleTable implements Countable, Iterator, ArrayAccess -{ - /** - * Automatically wrap text to fit into a column. - * @see ezcConsoleTable::$options - */ - const WRAP_AUTO = 1; - - /** - * Do not wrap text. Columns will be extended to fit the largest text. - * ATTENTION: This is risky! - * @see ezcConsoleTable::$options - */ - const WRAP_NONE = 2; - - /** - * Text will be cut to fit into a column. - * @see ezcConsoleTable::$options - */ - const WRAP_CUT = 3; - - /** - * Align text in the default direction. - */ - const ALIGN_DEFAULT = -1; - /** - * Align text in cells to the right. - */ - const ALIGN_LEFT = STR_PAD_RIGHT; - /** - * Align text in cells to the left. - */ - const ALIGN_RIGHT = STR_PAD_LEFT; - /** - * Align text in cells to the center. - */ - const ALIGN_CENTER = STR_PAD_BOTH; - - /** - * The width given by settings must be used even if the data allows it smaller. - */ - const WIDTH_FIXED = 1; - /** - * The width given by settings is a maximum value, if data allows it, the table gets smaller. - */ - const WIDTH_MAX = 2; - - /** - * Container to hold the properties - * - * @var array(string=>mixed) - */ - protected $properties; - - /** - * The ezcConsoleOutput object to use. - * - * @var ezcConsoleOutput - */ - protected $outputHandler; - - /** - * Collection of the rows that are contained in the table. - * - * @var array(int=>ezcConsoleTableRow) - */ - protected $rows; - - /** - * Creates a new table. - * - * @param ezcConsoleOutput $outHandler Output handler to utilize - * @param int $width Overall width of the table (chars). - * @param array $options Options - * - * @see ezcConsoleTable::$options - * - * @throws ezcBaseValueException On an invalid setting. - */ - public function __construct( ezcConsoleOutput $outHandler, $width, $options = array() ) - { - $this->rows = array(); - $this->outputHandler = $outHandler; - $this->__set( 'width', $width ); - if ( $options instanceof ezcConsoleTableOptions ) - { - $this->properties['options'] = $options; - } - else if ( is_array( $options ) ) - { - $this->properties['options'] = new ezcConsoleTableOptions( $options ); - } - else - { - throw new ezcBaseValueException( "options", $options, "array" ); - } - } - - /** - * Set new options. - * This method allows you to change the options of the table. - * - * @param ezcConsoleTableOptions $options The options to set. - * - * @throws ezcBaseSettingNotFoundException - * If you tried to set a non-existent option value. - * @throws ezcBaseSettingValueException - * If the value is not valid for the desired option. - * @throws ezcBaseValueException - * If you submit neither an array nor an instance of - * ezcConsoleTableOptions. - */ - public function setOptions( $options = array() ) - { - if ( is_array( $options ) ) - { - $this->properties['options']->merge( $options ); - } - else if ( $options instanceof ezcConsoleTableOptions ) - { - $this->properties['options'] = $options; - } - else - { - throw new ezcBaseValueException( "options", $options, "instance of ezcConsoleTableOptions" ); - } - } - - /** - * Returns the current options. - * Returns the options currently set for this table. - * - * @return ezcConsoleTableOptions The current options. - */ - public function getOptions() - { - return $this->properties['options']; - } - - /** - * Returns the table in a string. - * Returns the entire table as an array of printable lines. Each element of - * the array represents a physical line of the drawn table, including all - * borders and stuff, so you can simply print the table using - * - * echo implode( "\n" , $table->getTable() ): - * - * which is basically what {@link ezcConsoleTable::outputTable()} does. - * - * @return array An array representation of the table. - */ - public function getTable() - { - return $this->generateTable(); - } - - /** - * Output the table. - * Prints the complete table to the console. - * - * @return void - */ - public function outputTable() - { - echo implode( "\n", $this->generateTable() ); - } - - /** - * Returns if the given offset exists. - * This method is part of the ArrayAccess interface to allow access to the - * data of this object as if it was an array. - * - * @param int $offset The offset to check. - * @return bool True when the offset exists, otherwise false. - * - * @throws ezcBaseValueException - * If a non numeric row ID is requested. - */ - public function offsetExists( $offset ) - { - if ( !is_int( $offset ) || $offset < 0 ) - { - throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' ); - } - return isset( $this->rows[$offset] ); - } - - // From here only interface method implementations follow, which are not intended for direct usage - - /** - * Returns the element with the given offset. - * This method is part of the ArrayAccess interface to allow access to the - * data of this object as if it was an array. In case of the - * ezcConsoleTable class this method always returns a valid row object - * since it creates them on the fly, if a given item does not exist. - * - * @param int $offset The offset to check. - * @return ezcConsoleTableCell - * - * @throws ezcBaseValueException - * If a non numeric row ID is requested. - */ - public function offsetGet( $offset ) - { - if ( !isset( $offset ) ) - { - $offset = count( $this ); - $this->rows[$offset] = new ezcConsoleTableRow(); - } - if ( !is_int( $offset ) || $offset < 0 ) - { - throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' ); - } - if ( !isset( $this->rows[$offset] ) ) - { - $this->rows[$offset] = new ezcConsoleTableRow(); - } - return $this->rows[$offset]; - } - - /** - * Set the element with the given offset. - * This method is part of the ArrayAccess interface to allow access to the - * data of this object as if it was an array. - * - * @param int $offset The offset to assign an item to. - * @param ezcConsoleTableCell The row to assign. - * @return void - * - * @throws ezcBaseValueException - * If a non numeric row ID is requested. - * @throws ezcBaseValueException - * If the provided value is not of type {@ling ezcConsoleTableRow}. - */ - public function offsetSet( $offset, $value ) - { - if ( !( $value instanceof ezcConsoleTableRow ) ) - { - throw new ezcBaseValueException( 'value', $value, 'ezcConsoleTableRow' ); - } - if ( !isset( $offset ) ) - { - $offset = count( $this ); - } - if ( !is_int( $offset ) || $offset < 0 ) - { - throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' ); - } - $this->rows[$offset] = $value; - } - - /** - * Unset the element with the given offset. - * This method is part of the ArrayAccess interface to allow access to the - * data of this object as if it was an array. - * - * @param int $offset The offset to unset the value for. - * @return void - * - * @throws ezcBaseValueException - * If a non numeric row ID is requested. - */ - public function offsetUnset( $offset ) - { - if ( !is_int( $offset ) || $offset < 0 ) - { - throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' ); - } - if ( isset( $this->rows[$offset] ) ) - { - unset( $this->rows[$offset] ); - } - } - - /** - * Returns the number of cells in the row. - * This method is part of the Countable interface to allow the usage of - * PHP's count() function to check how many cells this row has. - * - * @return int Number of cells in this row. - */ - public function count() - { - $keys = array_keys( $this->rows ); - return count( $keys ) > 0 ? ( end( $keys ) + 1 ) : 0; - } - - /** - * Returns the currently selected cell. - * This method is part of the Iterator interface to allow access to the - * cells of this row by iterating over it like an array (e.g. using - * foreach). - * - * @return ezcConsoleTableCell The currently selected cell. - */ - public function current() - { - return current( $this->rows ); - } - - /** - * Returns the key of the currently selected cell. - * This method is part of the Iterator interface to allow access to the - * cells of this row by iterating over it like an array (e.g. using - * foreach). - * - * @return int The key of the currently selected cell. - */ - public function key() - { - return key( $this->rows ); - } - - /** - * Returns the next cell and selects it or false on the last cell. - * This method is part of the Iterator interface to allow access to the - * cells of this row by iterating over it like an array (e.g. using - * foreach). - * - * @return mixed ezcConsoleTableCell if the next cell exists, or false. - */ - public function next() - { - return next( $this->rows ); - } - - /** - * Selects the very first cell and returns it. - * This method is part of the Iterator interface to allow access to the - * cells of this row by iterating over it like an array (e.g. using - * foreach). - * - * @return ezcConsoleTableCell The very first cell of this row. - */ - public function rewind() - { - return reset( $this->rows ); - } - - /** - * Returns if the current cell is valid. - * This method is part of the Iterator interface to allow access to the - * cells of this row by iterating over it like an array (e.g. using - * foreach). - * - * @return ezcConsoleTableCell The very first cell of this row. - */ - public function valid() - { - return current( $this->rows ) !== false; - } - - /** - * Property read access. - * - * @param string $key Name of the property. - * @return mixed Value of the property or null. - * - * @throws ezcBasePropertyNotFoundException - * If the the desired property is not found. - * @ignore - */ - public function __get( $key ) - { - switch ( $key ) - { - case 'options': - case 'width': - return $this->properties[$key]; - default: - break; - } - throw new ezcBasePropertyNotFoundException( $key ); - } - - /** - * Property write access. - * - * @param string $key Name of the property. - * @param mixed $val The value for the property. - * - * @throws ezcBasePropertyNotFoundException - * If a the value for the property options is not an instance of - * @throws ezcBaseValueException - * If a the value for a property is out of range. - * @ignore - */ - public function __set( $key, $val ) - { - switch ( $key ) - { - case 'options': - if ( !( $val instanceof ezcConsoleTableOptions ) ) - { - throw new ezcBaseValueException( $key, $val, 'ezcConsoleTableOptions' ); - } - $this->properties['options'] = $val; - return; - case 'width': - if ( $val < 1 ) - { - throw new ezcBaseValueException( $key, $val, 'int > 0' ); - } - $this->properties[$key] = $val; - return; - default: - break; - } - throw new ezcBasePropertyNotFoundException( $key ); - } - - /** - * Property isset access. - * - * @param string $key Name of the property. - * @return bool True is the property is set, otherwise false. - * @ignore - */ - public function __isset( $key ) - { - switch ( $key ) - { - case 'options': - case 'width': - case 'cols': - return true; - } - return false; - } - - /** - * Generate the complete table as an array. - * - * @return array(int=>string) The table. - */ - private function generateTable() - { - $colWidth = $this->getColWidths(); - $table = array(); - $table[] = $this->generateBorder( $colWidth, $this[0]->borderFormat ); - // Rows submitted by the user - for ( $i = 0; $i < count( $this->rows ); $i++ ) - { - // Auto broken rows - foreach ( $this->breakRows( $this->rows[$i], $colWidth ) as $brkRow => $brkCells ) - { - $table[] = $this->generateRow( $brkCells, $colWidth, $this->rows[$i] ); - } - $afterBorderFormat = isset( $this->rows[$i + 1] ) && $this->rows[$i + 1]->borderFormat != 'default' ? $this->rows[$i + 1]->borderFormat : $this->rows[$i]->borderFormat; - $table[] = $this->generateBorder( $colWidth, $afterBorderFormat ); - } - return $table; - } - - /** - * Generate top/bottom borders of rows. - * - * @param array(int=>int) $colWidth Array of column width. - * @return string The Border string. - */ - private function generateBorder( $colWidth, $format ) - { - $border = ''; - foreach ( $colWidth as $col => $width ) - { - $border .= $this->properties['options']->corner . str_repeat( $this->properties['options']->lineVertical, $width + ( 2 * strlen( $this->properties['options']->colPadding ) ) ); - } - $border .= $this->properties['options']->corner; - - return $this->outputHandler->formatText( $border, $format ); - } - - /** - * Generate a single physical row. - * This method generates the string for a single physical table row. - * - * @param array(int=>string) $cells Cells of the row. - * @param array(int=>int) $colWidth Calculated columns widths. - * @return string The row. - */ - private function generateRow( $cells, $colWidth, $row ) - { - $rowData = ''; - for ( $cell = 0; $cell < count( $colWidth ); $cell++ ) - { - $align = $this->determineAlign( $row, $cell ); - $format = $this->determineFormat( $row, $cell ); - $borderFormat = $this->determineBorderFormat( $row ); - - $data = isset( $cells[$cell] ) ? $cells[$cell] : ''; - $rowData .= $this->outputHandler->formatText( - $this->properties['options']->lineHorizontal, - $borderFormat - ); - $rowData .= $this->properties['options']->colPadding; - $rowData .= $this->outputHandler->formatText( - str_pad( $data, $colWidth[$cell], ' ', $align ), - $format - ); - $rowData .= $this->properties['options']->colPadding; - } - $rowData .= $this->outputHandler->formatText( $this->properties['options']->lineHorizontal, $row->borderFormat ); - return $rowData; - } - - /** - * Determine the alignment of a cell. - * Walks the inheritance path upwards to determine the alignment of a - * cell. Checks first, if the cell has it's own alignment (apart from - * ezcConsoleTable::ALIGN_DEFAULT). If not, checks the row for an - * alignment setting and uses the default alignment if not found. - * - * @param ezcConsoleTableRow $row The row this cell belongs to. - * @param ezcConsoleTableCell $cellId Index of the desired cell. - * @return int An alignement constant (ezcConsoleTable::ALIGN_*). - */ - private function determineAlign( $row, $cellId = 0 ) - { - return ( $row[$cellId]->align !== ezcConsoleTable::ALIGN_DEFAULT - ? $row[$cellId]->align - : ( $row->align !== ezcConsoleTable::ALIGN_DEFAULT - ? $row->align - : ( $this->properties['options']->defaultAlign !== ezcConsoleTable::ALIGN_DEFAULT - ? $this->properties['options']->defaultAlign - : ezcConsoleTable::ALIGN_LEFT ) ) ); - } - - /** - * Determine the format of a cells content. - * Walks the inheritance path upwards to determine the format of a - * cells content. Checks first, if the cell has it's own format (apart - * from 'default'). If not, checks the row for a format setting and - * uses the default format if not found. - * - * @param ezcConsoleTableRow $row The row this cell belongs to. - * @param ezcConsoleTableCell $cell Index of the desired cell. - * @return string A format name. - */ - private function determineFormat( $row, $cellId ) - { - return ( $row[$cellId]->format != 'default' - ? $row[$cellId]->format - : ( $row->format !== 'default' - ? $row->format - : $this->properties['options']->defaultFormat ) ); - } - - /** - * Determine the format of a rows border. - * Walks the inheritance path upwards to determine the format of a - * rows border. Checks first, if the row has it's own format (apart - * from 'default'). If not, uses the default format. - * - * @param ezcConsoleTableRow $row The row this cell belongs to. - * @return string A format name. - */ - private function determineBorderFormat( $row ) - { - return $row->borderFormat !== 'default' - ? $row->borderFormat - : $this->properties['options']->defaultBorderFormat; - } - - /** - * Returns auto broken rows from an array of cells. - * The data provided by a user may not fit into a cell calculated by the - * class. In this case, the data can be automatically wrapped. The table - * row then spans over multiple physical console lines. - * - * @param array(int=>string) $cells Array of cells in one row. - * @param array(int=>int) $colWidth Columns widths array. - * @return array(int=>string) Physical rows generated out of this row. - */ - private function breakRows( $cells, $colWidth ) - { - $rows = array(); - // Iterate through cells of the row - foreach ( $colWidth as $cell => $width ) - { - $data = $cells[$cell]->content; - // Physical row id, start with 0 for each row - $row = 0; - // Split into multiple physical rows if manual breaks exist - $dataLines = explode( "\n", $data ); - foreach ( $dataLines as $dataLine ) - { - // Does the physical row fit? - if ( strlen( $dataLine ) > ( $colWidth[$cell] ) ) - { - switch ( $this->properties['options']->colWrap ) - { - case ezcConsoleTable::WRAP_AUTO: - $subLines = explode( "\n", wordwrap( $dataLine, $colWidth[$cell], "\n", true ) ); - foreach ( $subLines as $lineNo => $line ) - { - $rows[$row++][$cell] = $line; - } - break; - case ezcConsoleTable::WRAP_CUT: - $rows[$row++][$cell] = substr( $dataLine, 0, $colWidth[$cell] ); - break; - case ezcConsoleTable::WRAP_NONE: - default: - $rows[$row++][$cell] = $dataLine; - break; - } - } - else - { - $rows[$row++][$cell] = $dataLine; - } - } - } - return $rows; - } - - /** - * Determine width of each single column. - * - * @return void - */ - private function getColWidths() - { - if ( is_array( $this->properties['options']->colWidth ) ) - { - return $this->properties['options']->colWidth; - } - // Determine number of columns: - $colCount = 0; - foreach ( $this->rows as $row ) - { - $colCount = max( sizeof( $row ), $colCount ); - } - $borderWidth = strlen( $this->properties['options']->lineHorizontal ); - // Subtract border and padding chars from global width - $globalWidth = $this->width - - ( - // Per column: 2 * border padding + 1 border - $colCount * ( 2 * strlen( $this->properties['options']->colPadding ) + $borderWidth ) - // 1 Additional border - ) - $borderWidth; - // Width of a column if each is made equal - $colNormWidth = round( $globalWidth / $colCount ); - $colMaxWidth = array(); - // Determine the longest data for each column - foreach ( $this->rows as $row => $cells ) - { - foreach ( $cells as $col => $cell ) - { - $colMaxWidth[$col] = isset( $colMaxWidth[$col] ) ? max( $colMaxWidth[$col], strlen( $cell->content ) ) : strlen( $cell->content ); - } - } - $colWidth = array(); - $colWidthOverflow = array(); - $spareWidth = 0; - // Make columns best fit - foreach ( $colMaxWidth as $col => $maxWidth ) - { - // Does the largest data of the column fit into the average size - // + what we have in spare from earlier columns? - if ( $maxWidth <= ( $colNormWidth + $spareWidth ) ) - { - // We fit in, make the column as large as necessary - $colWidth[$col] = $maxWidth; - $spareWidth += ( $colNormWidth - $maxWidth ); - } - else - { - // Does not fit, use maximal possible width - $colWidth[$col] = $colNormWidth + $spareWidth; - $spareWidth = 0; - // Store overflow for second processing step - $colWidthOverflow[$col] = $maxWidth - $colWidth[$col]; - } - } - // Do we have spare to give to the columns again? - if ( $spareWidth > 0 ) - { - // Second processing step - if ( count( $colWidthOverflow ) > 0 ) - { - $overflowSum = array_sum( $colWidthOverflow ); - foreach ( $colWidthOverflow as $col => $overflow ); - { - $colWidth[$col] += floor( $overflow / $overflowSum * $spareWidth ); - } - } - elseif ( $this->properties['options']->widthType === ezcConsoleTable::WIDTH_FIXED ) - { - $widthSum = array_sum( $colWidth ); - foreach ( $colWidth as $col => $width ) - { - $colWidth[$col] += floor( $width / $widthSum * $spareWidth ); - } - } - } - // Finally sanitize values from rounding issues, if necessary - if ( ( $colSum = array_sum( $colWidth ) ) != $globalWidth && $this->properties['options']->widthType === ezcConsoleTable::WIDTH_FIXED ) - { - $colWidth[count( $colWidth ) - 1] -= $colSum - $globalWidth; - } - return $colWidth; - } -} -?> +format. The second dimension gives + * you direct access to the cells of your table, like $table[0][0] accesses the + * first cell in the first row of your table. You can access its properties + * diretly here, too. This works like e.g. $table[0][0]->format. Table row and + * cell objects are created on the fly, when you access them for the first time. + * You can also create them as if you simply create new array elements. E.g. + * $table[] creates a new row in the table. + * + * + * // Initialize the console output handler + * $out = new ezcConsoleOutput(); + * // Define a new format "headline" + * $out->formats->headline->color = 'red'; + * $out->formats->headline->style = array( 'bold' ); + * // Define a new format "sum" + * $out->formats->sum->color = 'blue'; + * $out->formats->sum->style = array( 'negative' ); + * + * // Create a new table + * $table = new ezcConsoleTable( $out, 60 ); + * + * // Create first row and in it the first cell + * $table[0][0]->content = 'Headline 1'; + * + * // Create 3 more cells in row 0 + * for ( $i = 2; $i < 5; $i++ ) + * { + * $table[0][]->content = "Headline $i"; + * } + * + * $data = array( 1, 2, 3, 4 ); + * + * // Create some more data in the table... + * foreach ( $data as $value ) + * { + * // Create a new row each time and set it's contents to the actual value + * $table[][0]->content = $value; + * } + * + * // Set another border format for our headline row + * $table[0]->borderFormat = 'headline'; + * + * // Set the content format for all cells of the 3rd row to "sum" + * $table[2]->format = 'sum'; + * + * $table->outputTable(); + * + * + * @property ezcConsoleTableOptions $options + * Contains the options for this class. + * @property int $width + * Width of the table. + * + * @see ezcConsoleOutput + * @package ConsoleTools + * @version 1.1.3 + * @mainclass + */ +class ezcConsoleTable implements Countable, Iterator, ArrayAccess +{ + /** + * Automatically wrap text to fit into a column. + * @see ezcConsoleTable::$options + */ + const WRAP_AUTO = 1; + + /** + * Do not wrap text. Columns will be extended to fit the largest text. + * ATTENTION: This is risky! + * @see ezcConsoleTable::$options + */ + const WRAP_NONE = 2; + + /** + * Text will be cut to fit into a column. + * @see ezcConsoleTable::$options + */ + const WRAP_CUT = 3; + + /** + * Align text in the default direction. + */ + const ALIGN_DEFAULT = -1; + /** + * Align text in cells to the right. + */ + const ALIGN_LEFT = STR_PAD_RIGHT; + /** + * Align text in cells to the left. + */ + const ALIGN_RIGHT = STR_PAD_LEFT; + /** + * Align text in cells to the center. + */ + const ALIGN_CENTER = STR_PAD_BOTH; + + /** + * The width given by settings must be used even if the data allows it smaller. + */ + const WIDTH_FIXED = 1; + /** + * The width given by settings is a maximum value, if data allows it, the table gets smaller. + */ + const WIDTH_MAX = 2; + + /** + * Container to hold the properties + * + * @var array(string=>mixed) + */ + protected $properties; + + /** + * The ezcConsoleOutput object to use. + * + * @var ezcConsoleOutput + */ + protected $outputHandler; + + /** + * Collection of the rows that are contained in the table. + * + * @var array(int=>ezcConsoleTableRow) + */ + protected $rows; + + /** + * Creates a new table. + * + * @param ezcConsoleOutput $outHandler Output handler to utilize + * @param int $width Overall width of the table (chars). + * @param array $options Options + * + * @see ezcConsoleTable::$options + * + * @throws ezcBaseValueException On an invalid setting. + */ + public function __construct(ezcConsoleOutput $outHandler, $width, $options = array()) + { + $this->rows = array(); + $this->outputHandler = $outHandler; + $this->__set('width', $width); + if ($options instanceof ezcConsoleTableOptions) { + $this->properties['options'] = $options; + } elseif (is_array($options)) { + $this->properties['options'] = new ezcConsoleTableOptions($options); + } else { + throw new ezcBaseValueException("options", $options, "array"); + } + } + + /** + * Set new options. + * This method allows you to change the options of the table. + * + * @param ezcConsoleTableOptions $options The options to set. + * + * @throws ezcBaseSettingNotFoundException + * If you tried to set a non-existent option value. + * @throws ezcBaseSettingValueException + * If the value is not valid for the desired option. + * @throws ezcBaseValueException + * If you submit neither an array nor an instance of + * ezcConsoleTableOptions. + */ + public function setOptions($options = array()) + { + if (is_array($options)) { + $this->properties['options']->merge($options); + } elseif ($options instanceof ezcConsoleTableOptions) { + $this->properties['options'] = $options; + } else { + throw new ezcBaseValueException("options", $options, "instance of ezcConsoleTableOptions"); + } + } + + /** + * Returns the current options. + * Returns the options currently set for this table. + * + * @return ezcConsoleTableOptions The current options. + */ + public function getOptions() + { + return $this->properties['options']; + } + + /** + * Returns the table in a string. + * Returns the entire table as an array of printable lines. Each element of + * the array represents a physical line of the drawn table, including all + * borders and stuff, so you can simply print the table using + * + * echo implode( "\n" , $table->getTable() ): + * + * which is basically what {@link ezcConsoleTable::outputTable()} does. + * + * @return array An array representation of the table. + */ + public function getTable() + { + return $this->generateTable(); + } + + /** + * Output the table. + * Prints the complete table to the console. + * + * @return void + */ + public function outputTable() + { + echo implode("\n", $this->generateTable()); + } + + /** + * Returns if the given offset exists. + * This method is part of the ArrayAccess interface to allow access to the + * data of this object as if it was an array. + * + * @param int $offset The offset to check. + * @return bool True when the offset exists, otherwise false. + * + * @throws ezcBaseValueException + * If a non numeric row ID is requested. + */ + public function offsetExists($offset) + { + if (!is_int($offset) || $offset < 0) { + throw new ezcBaseValueException('offset', $offset, 'int >= 0'); + } + return isset($this->rows[$offset]); + } + + // From here only interface method implementations follow, which are not intended for direct usage + + /** + * Returns the element with the given offset. + * This method is part of the ArrayAccess interface to allow access to the + * data of this object as if it was an array. In case of the + * ezcConsoleTable class this method always returns a valid row object + * since it creates them on the fly, if a given item does not exist. + * + * @param int $offset The offset to check. + * @return ezcConsoleTableCell + * + * @throws ezcBaseValueException + * If a non numeric row ID is requested. + */ + public function offsetGet($offset) + { + if (!isset($offset)) { + $offset = count($this); + $this->rows[$offset] = new ezcConsoleTableRow(); + } + if (!is_int($offset) || $offset < 0) { + throw new ezcBaseValueException('offset', $offset, 'int >= 0'); + } + if (!isset($this->rows[$offset])) { + $this->rows[$offset] = new ezcConsoleTableRow(); + } + return $this->rows[$offset]; + } + + /** + * Set the element with the given offset. + * This method is part of the ArrayAccess interface to allow access to the + * data of this object as if it was an array. + * + * @param int $offset The offset to assign an item to. + * @param ezcConsoleTableCell The row to assign. + * @return void + * + * @throws ezcBaseValueException + * If a non numeric row ID is requested. + * @throws ezcBaseValueException + * If the provided value is not of type {@ling ezcConsoleTableRow}. + */ + public function offsetSet($offset, $value) + { + if (!( $value instanceof ezcConsoleTableRow )) { + throw new ezcBaseValueException('value', $value, 'ezcConsoleTableRow'); + } + if (!isset($offset)) { + $offset = count($this); + } + if (!is_int($offset) || $offset < 0) { + throw new ezcBaseValueException('offset', $offset, 'int >= 0'); + } + $this->rows[$offset] = $value; + } + + /** + * Unset the element with the given offset. + * This method is part of the ArrayAccess interface to allow access to the + * data of this object as if it was an array. + * + * @param int $offset The offset to unset the value for. + * @return void + * + * @throws ezcBaseValueException + * If a non numeric row ID is requested. + */ + public function offsetUnset($offset) + { + if (!is_int($offset) || $offset < 0) { + throw new ezcBaseValueException('offset', $offset, 'int >= 0'); + } + if (isset($this->rows[$offset])) { + unset($this->rows[$offset]); + } + } + + /** + * Returns the number of cells in the row. + * This method is part of the Countable interface to allow the usage of + * PHP's count() function to check how many cells this row has. + * + * @return int Number of cells in this row. + */ + public function count() + { + $keys = array_keys($this->rows); + return count($keys) > 0 ? ( end($keys) + 1 ) : 0; + } + + /** + * Returns the currently selected cell. + * This method is part of the Iterator interface to allow access to the + * cells of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return ezcConsoleTableCell The currently selected cell. + */ + public function current() + { + return current($this->rows); + } + + /** + * Returns the key of the currently selected cell. + * This method is part of the Iterator interface to allow access to the + * cells of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return int The key of the currently selected cell. + */ + public function key() + { + return key($this->rows); + } + + /** + * Returns the next cell and selects it or false on the last cell. + * This method is part of the Iterator interface to allow access to the + * cells of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return mixed ezcConsoleTableCell if the next cell exists, or false. + */ + public function next() + { + return next($this->rows); + } + + /** + * Selects the very first cell and returns it. + * This method is part of the Iterator interface to allow access to the + * cells of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return ezcConsoleTableCell The very first cell of this row. + */ + public function rewind() + { + return reset($this->rows); + } + + /** + * Returns if the current cell is valid. + * This method is part of the Iterator interface to allow access to the + * cells of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return ezcConsoleTableCell The very first cell of this row. + */ + public function valid() + { + return current($this->rows) !== false; + } + + /** + * Property read access. + * + * @param string $key Name of the property. + * @return mixed Value of the property or null. + * + * @throws ezcBasePropertyNotFoundException + * If the the desired property is not found. + * @ignore + */ + public function __get($key) + { + switch ($key) { + case 'options': + case 'width': + return $this->properties[$key]; + default: + break; + } + throw new ezcBasePropertyNotFoundException($key); + } + + /** + * Property write access. + * + * @param string $key Name of the property. + * @param mixed $val The value for the property. + * + * @throws ezcBasePropertyNotFoundException + * If a the value for the property options is not an instance of + * @throws ezcBaseValueException + * If a the value for a property is out of range. + * @ignore + */ + public function __set($key, $val) + { + switch ($key) { + case 'options': + if (!( $val instanceof ezcConsoleTableOptions )) { + throw new ezcBaseValueException($key, $val, 'ezcConsoleTableOptions'); + } + $this->properties['options'] = $val; + return; + case 'width': + if ($val < 1) { + throw new ezcBaseValueException($key, $val, 'int > 0'); + } + $this->properties[$key] = $val; + return; + default: + break; + } + throw new ezcBasePropertyNotFoundException($key); + } + + /** + * Property isset access. + * + * @param string $key Name of the property. + * @return bool True is the property is set, otherwise false. + * @ignore + */ + public function __isset($key) + { + switch ($key) { + case 'options': + case 'width': + case 'cols': + return true; + } + return false; + } + + /** + * Generate the complete table as an array. + * + * @return array(int=>string) The table. + */ + private function generateTable() + { + $colWidth = $this->getColWidths(); + $table = array(); + $table[] = $this->generateBorder($colWidth, $this[0]->borderFormat); + // Rows submitted by the user + for ($i = 0; $i < count($this->rows); $i++) { + // Auto broken rows + foreach ($this->breakRows($this->rows[$i], $colWidth) as $brkRow => $brkCells) { + $table[] = $this->generateRow($brkCells, $colWidth, $this->rows[$i]); + } + $afterBorderFormat = isset($this->rows[$i + 1]) && $this->rows[$i + 1]->borderFormat != 'default' ? $this->rows[$i + 1]->borderFormat : $this->rows[$i]->borderFormat; + $table[] = $this->generateBorder($colWidth, $afterBorderFormat); + } + return $table; + } + + /** + * Generate top/bottom borders of rows. + * + * @param array(int=>int) $colWidth Array of column width. + * @return string The Border string. + */ + private function generateBorder($colWidth, $format) + { + $border = ''; + foreach ($colWidth as $col => $width) { + $border .= $this->properties['options']->corner . str_repeat($this->properties['options']->lineVertical, $width + ( 2 * strlen($this->properties['options']->colPadding) )); + } + $border .= $this->properties['options']->corner; + + return $this->outputHandler->formatText($border, $format); + } + + /** + * Generate a single physical row. + * This method generates the string for a single physical table row. + * + * @param array(int=>string) $cells Cells of the row. + * @param array(int=>int) $colWidth Calculated columns widths. + * @return string The row. + */ + private function generateRow($cells, $colWidth, $row) + { + $rowData = ''; + for ($cell = 0; $cell < count($colWidth); $cell++) { + $align = $this->determineAlign($row, $cell); + $format = $this->determineFormat($row, $cell); + $borderFormat = $this->determineBorderFormat($row); + + $data = isset($cells[$cell]) ? $cells[$cell] : ''; + $rowData .= $this->outputHandler->formatText( + $this->properties['options']->lineHorizontal, + $borderFormat + ); + $rowData .= $this->properties['options']->colPadding; + $rowData .= $this->outputHandler->formatText( + str_pad($data, $colWidth[$cell], ' ', $align), + $format + ); + $rowData .= $this->properties['options']->colPadding; + } + $rowData .= $this->outputHandler->formatText($this->properties['options']->lineHorizontal, $row->borderFormat); + return $rowData; + } + + /** + * Determine the alignment of a cell. + * Walks the inheritance path upwards to determine the alignment of a + * cell. Checks first, if the cell has it's own alignment (apart from + * ezcConsoleTable::ALIGN_DEFAULT). If not, checks the row for an + * alignment setting and uses the default alignment if not found. + * + * @param ezcConsoleTableRow $row The row this cell belongs to. + * @param ezcConsoleTableCell $cellId Index of the desired cell. + * @return int An alignement constant (ezcConsoleTable::ALIGN_*). + */ + private function determineAlign($row, $cellId = 0) + { + return ( $row[$cellId]->align !== ezcConsoleTable::ALIGN_DEFAULT + ? $row[$cellId]->align + : ( $row->align !== ezcConsoleTable::ALIGN_DEFAULT + ? $row->align + : ( $this->properties['options']->defaultAlign !== ezcConsoleTable::ALIGN_DEFAULT + ? $this->properties['options']->defaultAlign + : ezcConsoleTable::ALIGN_LEFT ) ) ); + } + + /** + * Determine the format of a cells content. + * Walks the inheritance path upwards to determine the format of a + * cells content. Checks first, if the cell has it's own format (apart + * from 'default'). If not, checks the row for a format setting and + * uses the default format if not found. + * + * @param ezcConsoleTableRow $row The row this cell belongs to. + * @param ezcConsoleTableCell $cell Index of the desired cell. + * @return string A format name. + */ + private function determineFormat($row, $cellId) + { + return ( $row[$cellId]->format != 'default' + ? $row[$cellId]->format + : ( $row->format !== 'default' + ? $row->format + : $this->properties['options']->defaultFormat ) ); + } + + /** + * Determine the format of a rows border. + * Walks the inheritance path upwards to determine the format of a + * rows border. Checks first, if the row has it's own format (apart + * from 'default'). If not, uses the default format. + * + * @param ezcConsoleTableRow $row The row this cell belongs to. + * @return string A format name. + */ + private function determineBorderFormat($row) + { + return $row->borderFormat !== 'default' + ? $row->borderFormat + : $this->properties['options']->defaultBorderFormat; + } + + /** + * Returns auto broken rows from an array of cells. + * The data provided by a user may not fit into a cell calculated by the + * class. In this case, the data can be automatically wrapped. The table + * row then spans over multiple physical console lines. + * + * @param array(int=>string) $cells Array of cells in one row. + * @param array(int=>int) $colWidth Columns widths array. + * @return array(int=>string) Physical rows generated out of this row. + */ + private function breakRows($cells, $colWidth) + { + $rows = array(); + // Iterate through cells of the row + foreach ($colWidth as $cell => $width) { + $data = $cells[$cell]->content; + // Physical row id, start with 0 for each row + $row = 0; + // Split into multiple physical rows if manual breaks exist + $dataLines = explode("\n", $data); + foreach ($dataLines as $dataLine) { + // Does the physical row fit? + if (strlen($dataLine) > ( $colWidth[$cell] )) { + switch ($this->properties['options']->colWrap) { + case ezcConsoleTable::WRAP_AUTO: + $subLines = explode("\n", wordwrap($dataLine, $colWidth[$cell], "\n", true)); + foreach ($subLines as $lineNo => $line) { + $rows[$row++][$cell] = $line; + } + break; + case ezcConsoleTable::WRAP_CUT: + $rows[$row++][$cell] = substr($dataLine, 0, $colWidth[$cell]); + break; + case ezcConsoleTable::WRAP_NONE: + default: + $rows[$row++][$cell] = $dataLine; + break; + } + } else { + $rows[$row++][$cell] = $dataLine; + } + } + } + return $rows; + } + + /** + * Determine width of each single column. + * + * @return void + */ + private function getColWidths() + { + if (is_array($this->properties['options']->colWidth)) { + return $this->properties['options']->colWidth; + } + // Determine number of columns: + $colCount = 0; + foreach ($this->rows as $row) { + $colCount = max(sizeof($row), $colCount); + } + $borderWidth = strlen($this->properties['options']->lineHorizontal); + // Subtract border and padding chars from global width + $globalWidth = $this->width + - ( + // Per column: 2 * border padding + 1 border + $colCount * ( 2 * strlen($this->properties['options']->colPadding) + $borderWidth ) + // 1 Additional border + ) - $borderWidth; + // Width of a column if each is made equal + $colNormWidth = round($globalWidth / $colCount); + $colMaxWidth = array(); + // Determine the longest data for each column + foreach ($this->rows as $row => $cells) { + foreach ($cells as $col => $cell) { + $colMaxWidth[$col] = isset($colMaxWidth[$col]) ? max($colMaxWidth[$col], strlen($cell->content)) : strlen($cell->content); + } + } + $colWidth = array(); + $colWidthOverflow = array(); + $spareWidth = 0; + // Make columns best fit + foreach ($colMaxWidth as $col => $maxWidth) { + // Does the largest data of the column fit into the average size + // + what we have in spare from earlier columns? + if ($maxWidth <= ( $colNormWidth + $spareWidth )) { + // We fit in, make the column as large as necessary + $colWidth[$col] = $maxWidth; + $spareWidth += ( $colNormWidth - $maxWidth ); + } else { + // Does not fit, use maximal possible width + $colWidth[$col] = $colNormWidth + $spareWidth; + $spareWidth = 0; + // Store overflow for second processing step + $colWidthOverflow[$col] = $maxWidth - $colWidth[$col]; + } + } + // Do we have spare to give to the columns again? + if ($spareWidth > 0) { + // Second processing step + if (count($colWidthOverflow) > 0) { + $overflowSum = array_sum($colWidthOverflow); + foreach ($colWidthOverflow as $col => $overflow) { + ; + $colWidth[$col] += floor($overflow / $overflowSum * $spareWidth); + } + } elseif ($this->properties['options']->widthType === ezcConsoleTable::WIDTH_FIXED) { + $widthSum = array_sum($colWidth); + foreach ($colWidth as $col => $width) { + $colWidth[$col] += floor($width / $widthSum * $spareWidth); + } + } + } + // Finally sanitize values from rounding issues, if necessary + if (( $colSum = array_sum($colWidth) ) != $globalWidth && $this->properties['options']->widthType === ezcConsoleTable::WIDTH_FIXED) { + $colWidth[count($colWidth) - 1] -= $colSum - $globalWidth; + } + return $colWidth; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/table/cell.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/table/cell.php index a05740e886e49db1bfdb67b8f7c543c922f215cf..be18712c63da28068d181c7c47680555b86b269f 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/table/cell.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/table/cell.php @@ -1,140 +1,133 @@ -mixed) - */ - protected $properties; - - /** - * Create a new ezcConsoleProgressbarCell. - * Creates a new ezcConsoleProgressbarCell. You can either submit the cell - * data through the constructor or set them as properties. - * - * @param int $verboseLevel Verbosity of the output to show. - * @param int $autobreak Auto wrap lines after num chars (0 = unlimited) - * @param bool $useFormats Whether to enable formated output - */ - public function __construct( $content = '', $format = 'default', $align = ezcConsoleTable::ALIGN_DEFAULT ) - { - $this->__set( 'content', $content ); - $this->__set( 'format', $format ); - $this->__set( 'align', $align ); - } - - /** - * Property read access. - * - * @param string $key Name of the property. - * @return mixed Value of the property or null. - * - * @throws ezcBasePropertyNotFoundException - * If the the desired property is not found. - * @ignore - */ - public function __get( $key ) - { - if ( isset( $this->properties[$key] ) ) - { - return $this->properties[$key]; - } - } - - /** - * Property write access. - * - * @param string $key Name of the property. - * @param mixed $val The value for the property. - * - * @throws ezcBaseValueException - * If a the value submitted for the align is not in the range of - * {@link ezcConsoleTable::ALIGN_LEFT}, - * {@link ezcConsoleTable::ALIGN_CENTER}, - * {@link ezcConsoleTable::ALIGN_RIGHT}, - * {@link ezcConsoleTable::ALIGN_DEFAULT} - * - * @ignore - */ - public function __set( $key, $val ) - { - - switch ( $key ) - { - case 'content': - case 'format': - $this->properties[$key] = $val; - return; - case 'align': - if ( $val !== ezcConsoleTable::ALIGN_LEFT - && $val !== ezcConsoleTable::ALIGN_CENTER - && $val !== ezcConsoleTable::ALIGN_RIGHT - && $val !== ezcConsoleTable::ALIGN_DEFAULT - ) - { - throw new ezcBaseValueException( $key, $val, 'ezcConsoleTable::ALIGN_DEFAULT, ezcConsoleTable::ALIGN_LEFT, ezcConsoleTable::ALIGN_CENTER, ezcConsoleTable::ALIGN_RIGHT' ); - } - $this->properties['align'] = $val; - return; - } - throw new ezcBasePropertyNotFoundException( $key ); - } - - /** - * Property isset access. - * - * @param string $key Name of the property. - * @return bool True is the property is set, otherwise false. - * @ignore - */ - public function __isset( $key ) - { - switch ( $key ) - { - case 'content': - case 'format': - case 'align': - return true; - default: - break; - } - return false; - } - -} - -?> +mixed) + */ + protected $properties; + + /** + * Create a new ezcConsoleProgressbarCell. + * Creates a new ezcConsoleProgressbarCell. You can either submit the cell + * data through the constructor or set them as properties. + * + * @param int $verboseLevel Verbosity of the output to show. + * @param int $autobreak Auto wrap lines after num chars (0 = unlimited) + * @param bool $useFormats Whether to enable formated output + */ + public function __construct($content = '', $format = 'default', $align = ezcConsoleTable::ALIGN_DEFAULT) + { + $this->__set('content', $content); + $this->__set('format', $format); + $this->__set('align', $align); + } + + /** + * Property read access. + * + * @param string $key Name of the property. + * @return mixed Value of the property or null. + * + * @throws ezcBasePropertyNotFoundException + * If the the desired property is not found. + * @ignore + */ + public function __get($key) + { + if (isset($this->properties[$key])) { + return $this->properties[$key]; + } + } + + /** + * Property write access. + * + * @param string $key Name of the property. + * @param mixed $val The value for the property. + * + * @throws ezcBaseValueException + * If a the value submitted for the align is not in the range of + * {@link ezcConsoleTable::ALIGN_LEFT}, + * {@link ezcConsoleTable::ALIGN_CENTER}, + * {@link ezcConsoleTable::ALIGN_RIGHT}, + * {@link ezcConsoleTable::ALIGN_DEFAULT} + * + * @ignore + */ + public function __set($key, $val) + { + + switch ($key) { + case 'content': + case 'format': + $this->properties[$key] = $val; + return; + case 'align': + if ($val !== ezcConsoleTable::ALIGN_LEFT + && $val !== ezcConsoleTable::ALIGN_CENTER + && $val !== ezcConsoleTable::ALIGN_RIGHT + && $val !== ezcConsoleTable::ALIGN_DEFAULT + ) { + throw new ezcBaseValueException($key, $val, 'ezcConsoleTable::ALIGN_DEFAULT, ezcConsoleTable::ALIGN_LEFT, ezcConsoleTable::ALIGN_CENTER, ezcConsoleTable::ALIGN_RIGHT'); + } + $this->properties['align'] = $val; + return; + } + throw new ezcBasePropertyNotFoundException($key); + } + + /** + * Property isset access. + * + * @param string $key Name of the property. + * @return bool True is the property is set, otherwise false. + * @ignore + */ + public function __isset($key) + { + switch ($key) { + case 'content': + case 'format': + case 'align': + return true; + default: + break; + } + return false; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/table/row.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/table/row.php index 8e14d1dae16f6f6379997ba18a9feae102500ba8..fc6a5d8db155aa755c20a5d5322fecfaf870b56d 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/table/row.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/src/table/row.php @@ -1,368 +1,349 @@ - - * // Create new table row - * $row = new ezcConsoleTableRow(); - * - * // Set default format of the row's cells - * $row->format = 'headline'; - * - * // On the fly create the cell no 0 - * $row[0]->content = 'Name'; - * // On the fly create the cell no 1 - * $row[1]->content = 'Cellphone'; - * - * // Change a setting on cell 0 - * $row[0]->align = ezcConsoleTable::ALIGN_CENTER; - * - * // Iterate through the row's cells. - * foreach ( $row as $cell ) - * { - * var_dump( $cell ); - * } - * - * // Set the default align property for all cells in the row - * $row->align = ezcConsoleTable::ALIGN_CENTER; - * - * - * - * This class stores the rows for the {@link ezcConsoleTable} class. - * - * @property string $borderFormat - * Set the format applied to the borders of this row. See - * {@link ezcConsoleOutput} - * @property string $format - * Format applied to cell contents of cells marked with - * format "default" in this row. - * @property mixed $align - * Alignment applied to cells marked with - * ezcConsoleTable::ALIGN_DEFAULT. - * - * @package ConsoleTools - * @version 1.1.3 - */ -class ezcConsoleTableRow implements Countable, Iterator, ArrayAccess -{ - /** - * Container to hold the properties - * - * @var array(string=>mixed) - */ - protected $properties; - - /** - * The cells of the row. - * - * @var array(ezcConsoleTableCell) - */ - protected $cells = array(); - - /** - * Create a new ezcConsoleProgressbarRow. - * Creates a new ezcConsoleProgressbarRow. - * - * This method takes any number of {@link ezcConsoleTableCell} objects as - * parameter, which will be added as table cells to the row in their - * specified order. - * - * @throws ezcBaseValueException - * If a parameter is not of type {@link ezcConsoleTableCell}. - */ - public function __construct() - { - $this->properties['borderFormat'] = 'default'; - $this->properties['format'] = 'default'; - $this->properties['align'] = ezcConsoleTable::ALIGN_DEFAULT; - - if ( func_num_args() > 0 ) - { - foreach ( func_get_args() as $id => $arg ) - { - if ( !( $arg instanceof ezcConsoleTableCell ) ) - { - throw new ezcBaseValueException( 'Parameter'.$id, $arg, 'ezcConsoleTableCell' ); - } - $this->cells[] = $arg; - } - } - } - - /** - * Returns if the given offset exists. - * This method is part of the ArrayAccess interface to allow access to the - * data of this object as if it was an array. - * - * @param int $offset The offset to check. - * @return bool True when the offset exists, otherwise false. - * - * @throws ezcBaseValueException - * If a non numeric cell ID is requested. - */ - public function offsetExists( $offset ) - { - if ( !is_int( $offset ) || $offset < 0 ) - { - throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' ); - } - return isset( $this->cells[$offset] ); - } - - /** - * Returns the element with the given offset. - * This method is part of the ArrayAccess interface to allow access to the - * data of this object as if it was an array. In case of the - * ezcConsoleTableRow class this method always returns a valid cell object - * since it creates them on the fly, if a given item does not exist. - * - * @param int $offset The offset to check. - * @return ezcConsoleTableCell - * - * @throws ezcBaseValueException - * If a non numeric cell ID is requested. - */ - public function offsetGet( $offset ) - { - if ( !isset( $offset ) ) - { - $offset = count( $this ); - $this->cells[$offset] = new ezcConsoleTableCell(); - } - if ( !is_int( $offset ) || $offset < 0 ) - { - throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' ); - } - if ( !isset( $this->cells[$offset] ) ) - { - $this->cells[$offset] = new ezcConsoleTableCell(); - } - return $this->cells[$offset]; - } - - /** - * Set the element with the given offset. - * This method is part of the ArrayAccess interface to allow access to the - * data of this object as if it was an array. - * - * @param int $offset The offset to assign an item to. - * @param ezcConsoleTableCell The cell to assign. - * @return void - * - * @throws ezcBaseValueException - * If a non numeric cell ID is requested. - * @throws ezcBaseValueException - * If the provided value is not of type {@ling ezcConsoleTableCell}. - */ - public function offsetSet( $offset, $value ) - { - if ( !( $value instanceof ezcConsoleTableCell ) ) - { - throw new ezcBaseValueException( 'value', $value, 'ezcConsoleTableCell' ); - } - if ( !isset( $offset ) ) - { - $offset = count( $this ); - } - if ( !is_int( $offset ) || $offset < 0 ) - { - throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' ); - } - $this->cells[$offset] = $value; - } - - /** - * Unset the element with the given offset. - * This method is part of the ArrayAccess interface to allow access to the - * data of this object as if it was an array. - * - * @param int $offset The offset to unset the value for. - * @return void - * - * @throws ezcBaseValueException - * If a non numeric cell ID is requested. - */ - public function offsetUnset( $offset ) - { - if ( !is_int( $offset ) || $offset < 0 ) - { - throw new ezcBaseValueException( 'offset', $offset, 'int >= 0' ); - } - if ( isset( $this->cells[$offset] ) ) - { - unset( $this->cells[$offset] ); - } - } - - /** - * Returns the number of cells in the row. - * This method is part of the Countable interface to allow the usage of - * PHP's count() function to check how many cells this row has. - * - * @return int Number of cells in this row. - */ - public function count() - { - $keys = array_keys( $this->cells ); - return count( $keys ) > 0 ? ( end( $keys ) + 1 ) : 0; - } - - /** - * Returns the currently selected cell. - * This method is part of the Iterator interface to allow acces to the - * cells of this row by iterating over it like an array (e.g. using - * foreach). - * - * @return ezcConsoleTableCell The currently selected cell. - */ - public function current() - { - return current( $this->cells ); - } - - /** - * Returns the key of the currently selected cell. - * This method is part of the Iterator interface to allow acces to the - * cells of this row by iterating over it like an array (e.g. using - * foreach). - * - * @return int The key of the currently selected cell. - */ - public function key() - { - return key( $this->cells ); - } - - /** - * Returns the next cell and selects it or false on the last cell. - * This method is part of the Iterator interface to allow acces to the - * cells of this row by iterating over it like an array (e.g. using - * foreach). - * - * @return mixed ezcConsoleTableCell if the next cell exists, or false. - */ - public function next() - { - return next( $this->cells ); - } - - /** - * Selects the very first cell and returns it. - * This method is part of the Iterator interface to allow acces to the - * cells of this row by iterating over it like an array (e.g. using - * foreach). - * - * @return ezcConsoleTableCell The very first cell of this row. - */ - public function rewind() - { - return reset( $this->cells ); - } - - /** - * Returns if the current cell is valid. - * This method is part of the Iterator interface to allow acces to the - * cells of this row by iterating over it like an array (e.g. using - * foreach). - * - * @return ezcConsoleTableCell The very first cell of this row. - */ - public function valid() - { - return current( $this->cells ) !== false; - } - - /** - * Property read access. - * - * @param string $key Name of the property. - * @return mixed Value of the property or null. - * - * @throws ezcBasePropertyNotFoundException - * If the the desired property is not found. - * @ignore - */ - public function __get( $key ) - { - if ( isset( $this->properties[$key] ) ) - { - return $this->properties[$key]; - } - } - - /** - * Property write access. - * - * @param string $key Name of the property. - * @param mixed $val The value for the property. - * - * @throws ezcBaseValueException - * If a the value submitted for the align is not in the range of - * {@link ezcConsoleTable::ALIGN_LEFT}, - * {@link ezcConsoleTable::ALIGN_CENTER}, - * {@link ezcConsoleTable::ALIGN_RIGHT}, - * {@link ezcConsoleTable::ALIGN_DEFAULT} - * - * @ignore - */ - public function __set( $key, $val ) - { - - switch ( $key ) - { - case 'format': - case 'borderFormat': - $this->properties[$key] = $val; - return; - case 'align': - if ( $val !== ezcConsoleTable::ALIGN_LEFT - && $val !== ezcConsoleTable::ALIGN_CENTER - && $val !== ezcConsoleTable::ALIGN_RIGHT - && $val !== ezcConsoleTable::ALIGN_DEFAULT - ) - { - throw new ezcBaseValueException( $key, $val, 'ezcConsoleTable::ALIGN_DEFAULT, ezcConsoleTable::ALIGN_LEFT, ezcConsoleTable::ALIGN_CENTER, ezcConsoleTable::ALIGN_RIGHT' ); - } - $this->properties['align'] = $val; - return; - } - throw new ezcBasePropertyNotFoundException( $key ); - } - - /** - * Property isset access. - * - * @param string $key Name of the property. - * @return bool True is the property is set, otherwise false. - * @ignore - */ - public function __isset( $key ) - { - switch ( $key ) - { - case 'content': - case 'format': - case 'align': - return true; - default: - break; - } - return false; - } - -} - -?> + + * // Create new table row + * $row = new ezcConsoleTableRow(); + * + * // Set default format of the row's cells + * $row->format = 'headline'; + * + * // On the fly create the cell no 0 + * $row[0]->content = 'Name'; + * // On the fly create the cell no 1 + * $row[1]->content = 'Cellphone'; + * + * // Change a setting on cell 0 + * $row[0]->align = ezcConsoleTable::ALIGN_CENTER; + * + * // Iterate through the row's cells. + * foreach ( $row as $cell ) + * { + * var_dump( $cell ); + * } + * + * // Set the default align property for all cells in the row + * $row->align = ezcConsoleTable::ALIGN_CENTER; + * + * + * + * This class stores the rows for the {@link ezcConsoleTable} class. + * + * @property string $borderFormat + * Set the format applied to the borders of this row. See + * {@link ezcConsoleOutput} + * @property string $format + * Format applied to cell contents of cells marked with + * format "default" in this row. + * @property mixed $align + * Alignment applied to cells marked with + * ezcConsoleTable::ALIGN_DEFAULT. + * + * @package ConsoleTools + * @version 1.1.3 + */ +class ezcConsoleTableRow implements Countable, Iterator, ArrayAccess +{ + /** + * Container to hold the properties + * + * @var array(string=>mixed) + */ + protected $properties; + + /** + * The cells of the row. + * + * @var array(ezcConsoleTableCell) + */ + protected $cells = array(); + + /** + * Create a new ezcConsoleProgressbarRow. + * Creates a new ezcConsoleProgressbarRow. + * + * This method takes any number of {@link ezcConsoleTableCell} objects as + * parameter, which will be added as table cells to the row in their + * specified order. + * + * @throws ezcBaseValueException + * If a parameter is not of type {@link ezcConsoleTableCell}. + */ + public function __construct() + { + $this->properties['borderFormat'] = 'default'; + $this->properties['format'] = 'default'; + $this->properties['align'] = ezcConsoleTable::ALIGN_DEFAULT; + + if (func_num_args() > 0) { + foreach (func_get_args() as $id => $arg) { + if (!( $arg instanceof ezcConsoleTableCell )) { + throw new ezcBaseValueException('Parameter'.$id, $arg, 'ezcConsoleTableCell'); + } + $this->cells[] = $arg; + } + } + } + + /** + * Returns if the given offset exists. + * This method is part of the ArrayAccess interface to allow access to the + * data of this object as if it was an array. + * + * @param int $offset The offset to check. + * @return bool True when the offset exists, otherwise false. + * + * @throws ezcBaseValueException + * If a non numeric cell ID is requested. + */ + public function offsetExists($offset) + { + if (!is_int($offset) || $offset < 0) { + throw new ezcBaseValueException('offset', $offset, 'int >= 0'); + } + return isset($this->cells[$offset]); + } + + /** + * Returns the element with the given offset. + * This method is part of the ArrayAccess interface to allow access to the + * data of this object as if it was an array. In case of the + * ezcConsoleTableRow class this method always returns a valid cell object + * since it creates them on the fly, if a given item does not exist. + * + * @param int $offset The offset to check. + * @return ezcConsoleTableCell + * + * @throws ezcBaseValueException + * If a non numeric cell ID is requested. + */ + public function offsetGet($offset) + { + if (!isset($offset)) { + $offset = count($this); + $this->cells[$offset] = new ezcConsoleTableCell(); + } + if (!is_int($offset) || $offset < 0) { + throw new ezcBaseValueException('offset', $offset, 'int >= 0'); + } + if (!isset($this->cells[$offset])) { + $this->cells[$offset] = new ezcConsoleTableCell(); + } + return $this->cells[$offset]; + } + + /** + * Set the element with the given offset. + * This method is part of the ArrayAccess interface to allow access to the + * data of this object as if it was an array. + * + * @param int $offset The offset to assign an item to. + * @param ezcConsoleTableCell The cell to assign. + * @return void + * + * @throws ezcBaseValueException + * If a non numeric cell ID is requested. + * @throws ezcBaseValueException + * If the provided value is not of type {@ling ezcConsoleTableCell}. + */ + public function offsetSet($offset, $value) + { + if (!( $value instanceof ezcConsoleTableCell )) { + throw new ezcBaseValueException('value', $value, 'ezcConsoleTableCell'); + } + if (!isset($offset)) { + $offset = count($this); + } + if (!is_int($offset) || $offset < 0) { + throw new ezcBaseValueException('offset', $offset, 'int >= 0'); + } + $this->cells[$offset] = $value; + } + + /** + * Unset the element with the given offset. + * This method is part of the ArrayAccess interface to allow access to the + * data of this object as if it was an array. + * + * @param int $offset The offset to unset the value for. + * @return void + * + * @throws ezcBaseValueException + * If a non numeric cell ID is requested. + */ + public function offsetUnset($offset) + { + if (!is_int($offset) || $offset < 0) { + throw new ezcBaseValueException('offset', $offset, 'int >= 0'); + } + if (isset($this->cells[$offset])) { + unset($this->cells[$offset]); + } + } + + /** + * Returns the number of cells in the row. + * This method is part of the Countable interface to allow the usage of + * PHP's count() function to check how many cells this row has. + * + * @return int Number of cells in this row. + */ + public function count() + { + $keys = array_keys($this->cells); + return count($keys) > 0 ? ( end($keys) + 1 ) : 0; + } + + /** + * Returns the currently selected cell. + * This method is part of the Iterator interface to allow acces to the + * cells of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return ezcConsoleTableCell The currently selected cell. + */ + public function current() + { + return current($this->cells); + } + + /** + * Returns the key of the currently selected cell. + * This method is part of the Iterator interface to allow acces to the + * cells of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return int The key of the currently selected cell. + */ + public function key() + { + return key($this->cells); + } + + /** + * Returns the next cell and selects it or false on the last cell. + * This method is part of the Iterator interface to allow acces to the + * cells of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return mixed ezcConsoleTableCell if the next cell exists, or false. + */ + public function next() + { + return next($this->cells); + } + + /** + * Selects the very first cell and returns it. + * This method is part of the Iterator interface to allow acces to the + * cells of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return ezcConsoleTableCell The very first cell of this row. + */ + public function rewind() + { + return reset($this->cells); + } + + /** + * Returns if the current cell is valid. + * This method is part of the Iterator interface to allow acces to the + * cells of this row by iterating over it like an array (e.g. using + * foreach). + * + * @return ezcConsoleTableCell The very first cell of this row. + */ + public function valid() + { + return current($this->cells) !== false; + } + + /** + * Property read access. + * + * @param string $key Name of the property. + * @return mixed Value of the property or null. + * + * @throws ezcBasePropertyNotFoundException + * If the the desired property is not found. + * @ignore + */ + public function __get($key) + { + if (isset($this->properties[$key])) { + return $this->properties[$key]; + } + } + + /** + * Property write access. + * + * @param string $key Name of the property. + * @param mixed $val The value for the property. + * + * @throws ezcBaseValueException + * If a the value submitted for the align is not in the range of + * {@link ezcConsoleTable::ALIGN_LEFT}, + * {@link ezcConsoleTable::ALIGN_CENTER}, + * {@link ezcConsoleTable::ALIGN_RIGHT}, + * {@link ezcConsoleTable::ALIGN_DEFAULT} + * + * @ignore + */ + public function __set($key, $val) + { + + switch ($key) { + case 'format': + case 'borderFormat': + $this->properties[$key] = $val; + return; + case 'align': + if ($val !== ezcConsoleTable::ALIGN_LEFT + && $val !== ezcConsoleTable::ALIGN_CENTER + && $val !== ezcConsoleTable::ALIGN_RIGHT + && $val !== ezcConsoleTable::ALIGN_DEFAULT + ) { + throw new ezcBaseValueException($key, $val, 'ezcConsoleTable::ALIGN_DEFAULT, ezcConsoleTable::ALIGN_LEFT, ezcConsoleTable::ALIGN_CENTER, ezcConsoleTable::ALIGN_RIGHT'); + } + $this->properties['align'] = $val; + return; + } + throw new ezcBasePropertyNotFoundException($key); + } + + /** + * Property isset access. + * + * @param string $key Name of the property. + * @return bool True is the property is set, otherwise false. + * @ignore + */ + public function __isset($key) + { + switch ($key) { + case 'content': + case 'format': + case 'align': + return true; + default: + break; + } + return false; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/input_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/input_test.php index 495baa8de6cba35278e2c7e04f4b49cd1a1de397..8a672d7a8c528063abb80f297f949e0a5c212604 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/input_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/input_test.php @@ -1,1205 +1,1176 @@ - 't', - 'long' => 'testing', - 'options' => array(), - ), - array( - 'short' => 's', - 'long' => 'subway', - 'options' => array(), - ), - array( - 'short' => '', - 'long' => 'carry', - 'options' => array(), - ), - array( - 'short' => 'v', - 'long' => 'visual', - 'options' => array( - 'multiple' => true, - 'arguments' => false, - ), - ), - array( - 'short' => 'o', - 'long' => 'original', - 'options' => array( - 'type' => ezcConsoleInput::TYPE_STRING, - ), - ), - array( - 'short' => 'b', - 'long' => 'build', - 'options' => array( - 'type' => ezcConsoleInput::TYPE_INT, - 'default' => 42, - ), - ), - array( - 'short' => 'd', - 'long' => 'destroy', - 'options' => array( - 'type' => ezcConsoleInput::TYPE_STRING, - 'default' => 'world', - ), - ), - array( - 'short' => 'y', - 'long' => 'yank', - 'options' => array( - 'type' => ezcConsoleInput::TYPE_STRING, - 'multiple' => true, - 'shorthelp' => 'Some stupid short text.', - 'longhelp' => 'Some even more stupid, but somewhat longer long describtion.', - ), - ), - array( - 'short' => 'c', - 'long' => 'console', - 'options' => array( - 'shorthelp' => 'Some stupid short text.', - 'longhelp' => 'Some even more stupid, but somewhat longer long describtion.', - 'depends' => array( 't', 'o', 'b', 'y' ), - ), - ), - array( - 'short' => 'e', - 'long' => 'edit', - 'options' => array( - 'excludes' => array( 't', 'y' ), - 'arguments' => false, - ), - ), - array( - 'short' => 'n', - 'long' => 'new', - 'options' => array( - 'depends' => array( 't', 'o' ), - 'excludes' => array( 'b', 'y' ), - 'arguments' => false, - ), - ), - ); - - private $testAliasesSuccess = array( - array( - 'short' => 'k', - 'long' => 'kelvin', - 'ref' => 't', - ), - array( - 'short' => 'f', - 'long' => 'foobar', - 'ref' => 'o', - ), - ); - - private $testAliasesFailure = array( - array( - 'short' => 'l', - 'long' => 'lurking', - 'ref' => 'x', - ), - array( - 'short' => 'e', - 'long' => 'elvis', - 'ref' => 'z', - ), - ); - - private $testArgsSuccess = array( - array( - 'foo.php', - '-o', - '"Test string2"', - '--build', - '42', - ), - array( - 'foo.php', - '-b', - '42', - '--yank', - '"a"', - '--yank', - '"b"', - '--yank', - '"c"', - ), - array( - 'foo.php', - '--yank=a', - '--yank=b', - '--yank="c"', - '-y', - '1', - '-y', - '2' - ), - array( - 'foo.php', - '--yank=a', - '--yank=b', - '-y', - '1', - 'arg1', - 'arg2', - ), - ); - - public static function suite() - { - return new PHPUnit_Framework_TestSuite( "ezcConsoleToolsInputTest" ); - } - - protected function setUp() - { - $this->input = new ezcConsoleInput(); - foreach ( $this->testOptions as $paramData ) - { - $this->input->registerOption( $this->createFakeOption( $paramData ) ); - } - } - - protected function createFakeOption( $paramData ) - { - $param = new ezcConsoleOption( $paramData['short'], $paramData['long'] ); - foreach ( $paramData['options'] as $name => $val ) - { - if ( $name === 'depends' ) - { - foreach ( $val as $dep ) - { - $param->addDependency( new ezcConsoleOptionRule( $this->input->getOption( $dep ) ) ); - } - continue; - } - if ( $name === 'excludes' ) - { - foreach ( $val as $dep ) - { - $param->addExclusion(new ezcConsoleOptionRule( $this->input->getOption( $dep ) ) ); - } - continue; - } - $param->$name = $val; - } - return $param; - } - - protected function tearDown() - { - unset( $this->input ); - } - - public function testRegisterParam() - { - $input = new ezcConsoleInput(); - foreach ( $this->testOptions as $optionData ) - { - $option = $this->createFakeOption( $optionData ); - $input->registerOption( $option ); - if ( $option->short !== '' ) - { - $this->assertEquals( - $option, - $input->getOption( $optionData['short'] ), - 'Parameter not registered correctly with short name <' . $optionData['short'] . '>.' - ); - } - $this->assertEquals( - $option, - $input->getOption( $optionData['long'] ), - 'Parameter not registered correctly with long name <' . $optionData['long'] . '>.' - ); - } - } - - public function testFromString() - { - $param = new ezcConsoleInput(); - $param->registerOptionString( '[a:|all:][u?|user?][i|info][o+test|overall+]' ); - $res['a'] = new ezcConsoleOption( - 'a', - 'all', - ezcConsoleInput::TYPE_NONE, - NULL, - false, - 'No help available.', - 'Sorry, there is no help text available for this parameter.', - array(), - array (), - true - ); - $res['u'] = new ezcConsoleOption( - 'u', - 'user', - ezcConsoleInput::TYPE_STRING, - '', - false, - 'No help available.', - 'Sorry, there is no help text available for this parameter.', - array (), - array (), - true - ); - $res['o'] = new ezcConsoleOption( - 'o', - 'overall', - ezcConsoleInput::TYPE_STRING, - 'test', - true, - 'No help available.', - 'Sorry, there is no help text available for this parameter.', - array (), - array (), - true - ); - $this->assertEquals( $res['a'], $param->getOption( 'a' ), 'Parameter -a not registered correctly.' ); - $this->assertEquals( $res['u'], $param->getOption( 'u' ), 'Parameter -u not registered correctly.' ); - $this->assertEquals( $res['o'], $param->getOption( 'o' ), 'Parameter -o not registered correctly.' ); - } - - /** - * testRegisterAliasSuccess - * - * @access public - */ - public function testRegisterAliasSuccess() - { - $validParams = array(); - foreach ( $this->input->getOptions() as $param ) - { - $validParams[$param->short] = $param; - } - foreach ( $this->testAliasesSuccess as $alias ) - { - try - { - $this->input->registerAlias( $alias['short'], $alias['long'], $validParams[$alias['ref']] ); - } - catch ( ezcConsoleException $e ) - { - $this->fail( $e->getMessage() ); - } - } - } - - /** - * testRegisterAliasFailure - * - * @access public - */ - public function testRegisterAliasFailure() - { - $exceptionCount = 0; - foreach ( $this->testAliasesFailure as $alias ) - { - try - { - $this->input->registerAlias( $alias['short'], $alias['long'], new ezcConsoleOption('foo', 'bar') ); - } - catch ( ezcConsoleOptionNotExistsException $e ) - { - $exceptionCount++; - } - } - // Expect every test data set to fail - $this->assertEquals( - $exceptionCount, - count( $this->testAliasesFailure ), - 'Alias registration succeded for ' . ( count( $this->testAliasesFailure ) - $exceptionCount ) . ' unkown parameters.' - ); - } - - // Single parameter tests - public function testProcessSuccessSingleShortNoValue() - { - $args = array( - 'foo.php', - '-t', - ); - $res = array( - 't' => true, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessSingleShortValue() - { - $args = array( - 'foo.php', - '-o', - 'bar' - ); - $res = array( - 'o' => 'bar', - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessSingleLongNoValue() - { - $args = array( - 'foo.php', - '--testing', - ); - $res = array( - 't' => true, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessSingleLongValue() - { - $args = array( - 'foo.php', - '--original', - 'bar' - ); - $res = array( - 'o' => 'bar', - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessFailureSingleShortDefault() - { - $args = array( - 'foo.php', - '-b' - ); - $res = array( - 'b' => 42, - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionMissingValueException' ); - } - - - public function testProcessFailureSingleLongDefault() - { - $args = array( - 'foo.php', - '--build' - ); - $res = array( - 'b' => 42, - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionMissingValueException' ); - } - - - public function testProcessSuccessSingleShortNoValueArguments() - { - $args = array( - 'foo.php', - '-s', - '--', - '-foo', - '--bar', - 'baz', - ); - $res = array( - 's' => true, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessSingleLongNoValueArguments() - { - $args = array( - 'foo.php', - '--subway', - '--', - '-foo', - '--bar', - 'baz', - ); - $res = array( - 's' => true, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - // Multiple parameter tests - public function testProcessSuccessMultipleShortNoValue() - { - $args = array( - 'foo.php', - '-t', - '-s', - ); - $res = array( - 't' => true, - 's' => true, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessMultipleShortValue() - { - $args = array( - 'foo.php', - '-o', - 'bar', - '-b', - '23' - ); - $res = array( - 'o' => 'bar', - 'b' => 23, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessMultipleLongNoValue() - { - $args = array( - 'foo.php', - '--testing', - '--subway', - ); - $res = array( - 't' => true, - 's' => true, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessMultipleLongValue() - { - $args = array( - 'foo.php', - '--original', - 'bar', - '--build', - '23', - ); - $res = array( - 'o' => 'bar', - 'b' => 23, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - - public function testProcessFailureMultipleShortDefault() - { - $args = array( - 'foo.php', - '-b', - '-d', - ); - $res = array( - 'b' => 42, - 'd' => 'world', - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionMissingValueException' ); - } - - public function testProcessFailureMultipleLongDefault() - { - $args = array( - 'foo.php', - '--build', - '--destroy', - ); - $res = array( - 'b' => 42, - 'd' => 'world', - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionMissingValueException' ); - } - - // Bug #8645: Default values not set correctly in ezcConsoleInput - public function testProcessSuccessDefault() - { - $args = array( - 'foo.php', - ); - $res = array( - 'b' => 42, - 'd' => 'world', - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessMultipleLongSameNoValue() - { - $args = array( - 'foo.php', - '--visual', - '--visual', - ); - $res = array( - 'v' => array( true, true ), - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessArguments_1() - { - $args = array( - 'foo.php', - '--original', - 'bar', - '--build', - '23', - 'argument', - '1', - '2', - ); - $res = array( - 0 => 'argument', - 1 => '1', - 2 => '2', - ); - $this->argumentsProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessDependencies() - { - $args = array( - 'foo.php', - '-t', - '-o', - 'bar', - '--build', - 23, - '-y', - 'text', - '--yank', - 'moretext', - '-c' // This one depends on -t, -o, -b and -y - ); - $res = array( - 't' => true, - 'o' => 'bar', - 'b' => 23, - 'y' => array( - 'text', - 'moretext' - ), - 'c' => true, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessExclusions() - { - $args = array( - 'foo.php', - '-o', - 'bar', - '--build', - 23, - '--edit' // This one exclude -t and -y - ); - $res = array( - 'o' => 'bar', - 'b' => 23, - 'e' => true, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessDependenciesExclusions() - { - $args = array( - 'foo.php', - '-t', - '-o', - 'bar', - '-n' // This one depends on -t and -o, but excludes -b and -y - ); - $res = array( - 't' => true, - 'o' => 'bar', - 'n' => true, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessMandatory() - { - $args = array( - 'foo.php', - '-q', - ); - $this->input->registerOption( - $this->createFakeOption( - array( - 'short' => 'q', - 'long' => 'quite', - 'options' => array( - 'mandatory' => true, - ), - ) - ) - ); - $res = array( - 'q' => true, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessMandatoryDefault() - { - $args = array( - 'foo.php', - '-q', - ); - $this->input->registerOption( - $this->createFakeOption( - array( - 'short' => 'q', - 'long' => 'quite', - 'options' => array( - 'default' => 'test', - 'mandatory' => true, - ), - ) - ) - ); - $res = array( - 'q' => true, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessSuccessHelp() - { - $args = array( - 'foo.php', - '-h', - ); - $this->input->registerOption( - $this->createFakeOption( - array( - 'short' => 'q', - 'long' => 'quite', - 'options' => array( - 'mandatory' => true, - ), - ) - ) - ); - $this->input->registerOption( - $this->createFakeOption( - array( - 'short' => 'h', - 'long' => 'help', - 'options' => array( - 'isHelpOption' => true, - ), - ) - ) - ); - $res = array( - 'h' => true, - ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessFailureExistance_1() - { - $args = array( - 'foo.php', - '-q', - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionNotExistsException' ); - } - - public function testProcessFailureExistance_2() - { - $args = array( - 'foo.php', - '-tools', - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionNotExistsException' ); - } - - public function testProcessFailureExistance_3() - { - $args = array( - 'foo.php', - '-testingaeiou', - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionNotExistsException' ); - } - - public function testProcessFailureTypeInt() - { - $args = array( - 'foo.php', - '-b', - 'not_an_int' - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionTypeViolationException' ); - } - - // Bug #9046: New bug: [ConsoleTools] Last argument not treated invalid option value - public function testProcessNoFailureTypeNone() - { - $args = array( - 'foo.php', - '-s', - 'a_parameter' - ); - $res = array( "s" => true ); - $this->commonProcessTestSuccess( $args, $res ); - } - - public function testProcessFailureTypeNone() - { - $args = array( - 'foo.php', - '-s', - 'a_parameter', - 'another_parameter' - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionTypeViolationException' ); - } - - public function testProcessFailureNovalue() - { - $args = array( - 'foo.php', - '-o', - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionMissingValueException' ); - } - - public function testProcessFailureMultiple() - { - $args = array( - 'foo.php', - '-d', - 'mars', - '--destroy', - 'venus', - - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionTooManyValuesException' ); - } - - public function testProcessFailureDependencies() - { - $args = array( - 'foo.php', - '-t', -// '-o', -// 'bar', - '--build', - 23, - '-y', - 'text', - '--yank', - 'moretext', - '-c' // This one depends on -t, -o, -b and -y - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionDependencyViolationException' ); - } - - public function testProcessFailureExclusions() - { - $args = array( - 'foo.php', - '-t', - '-o', - 'bar', - '--build', - 23, - '--edit' // This one excludes -t and -y - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionExclusionViolationException' ); - } - - public function testProcessFailureArguments() - { - $args = array( - 'foo.php', - '-t', - '--visual', // This one forbids arguments - '-o', - 'bar', - 'someargument', - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionArgumentsViolationException' ); - } - - public function testProcessFailureMandatory() - { - $args = array( - 'foo.php', - '-s', - ); - $this->input->registerOption( - $this->createFakeOption( - array( - 'short' => 'q', - 'long' => 'quite', - 'options' => array( - 'mandatory' => true, - ), - ) - ) - ); - $this->commonProcessTestFailure( $args, 'ezcConsoleOptionMandatoryViolationException' ); - } - - public function testGetHelp1() - { - $res = array( - array( - '-t / --testing', - 'No help available.', - ), - array( - '-s / --subway', - 'No help available.', - ), - array( - '--carry', - 'No help available.', - ), - array( - '-v / --visual', - 'No help available.', - ), - array( - '-o / --original', - 'No help available.', - ), - array( - '-b / --build', - 'No help available.', - ), - array( - '-d / --destroy', - 'No help available.', - ), - array( - '-y / --yank', - 'Some stupid short text.', - ), - array( - '-c / --console', - 'Some stupid short text.', - ), - array( - '-e / --edit', - 'No help available.', - ), - array( - '-n / --new', - 'No help available.', - ), - ); - $this->assertEquals( - $res, - $this->input->getHelp(), - 'Help array was not generated correctly.' - ); - } - - public function testGetHelp2() - { - $res = array( - array( - '-t / --testing', - 'Sorry, there is no help text available for this parameter.', - ), - array( - '-s / --subway', - 'Sorry, there is no help text available for this parameter.', - ), - array( - '--carry', - 'Sorry, there is no help text available for this parameter.', - ), - array( - '-v / --visual', - 'Sorry, there is no help text available for this parameter.', - ), - array( - '-o / --original', - 'Sorry, there is no help text available for this parameter.', - ), - array( - '-b / --build', - 'Sorry, there is no help text available for this parameter.', - ), - array( - '-d / --destroy', - 'Sorry, there is no help text available for this parameter.', - ), - array( - '-y / --yank', - 'Some even more stupid, but somewhat longer long describtion.', - ), - array( - '-c / --console', - 'Some even more stupid, but somewhat longer long describtion.', - ), - array( - '-e / --edit', - 'Sorry, there is no help text available for this parameter.', - ), - array( - '-n / --new', - 'Sorry, there is no help text available for this parameter.', - ), - ); - $this->assertEquals( - $res, - $this->input->getHelp( true ), - 'Help array was not generated correctly.' - ); - - } - - public function testGetHelp3() - { - $res = array( - array( - '-t / --testing', - 'No help available.', - ), - array( - '-s / --subway', - 'No help available.', - ), - array( - '-v / --visual', - 'No help available.', - ), - ); - $this->assertEquals( - $res, - $this->input->getHelp(false, array( 't', 's', 'v' ) ), - 'Help array was not generated correctly.' - ); - } - - public function testGetHelp4() - { - $res = array( - array( - '-t / --testing', - 'Sorry, there is no help text available for this parameter.', - ), - array( - '-s / --subway', - 'Sorry, there is no help text available for this parameter.', - ), - array( - '-y / --yank', - 'Some even more stupid, but somewhat longer long describtion.', - ), - array( - '-e / --edit', - 'Sorry, there is no help text available for this parameter.', - ), - array( - '-n / --new', - 'Sorry, there is no help text available for this parameter.', - ), - ); - $this->assertEquals( - $res, - $this->input->getHelp( true, array( 't', 'subway', 'yank', 'e', 'n' ) ), - 'Help array was not generated correctly.' - ); - - } - - public function testGetSynopsis() - { - $this->assertEquals( - '$ '.$_SERVER['argv'][0].' [-t] [-s] [--carry] [-v] [-o ] [-b 42] [-d "world"] [-y ] [-c] [-e] [-n] [[--] ]', - $this->input->getSynopsis(), - 'Program synopsis not generated correctly.' - ); - } - - public function testGetHelpTable() - { - $output = new ezcConsoleOutput(); - - $res = new ezcConsoleTable( $output, 80 ); - $res[0][0]->content = '-t / --testing'; - $res[0][1]->content = 'Sorry, there is no help text available for this parameter.'; - - $res[1][0]->content = '-s / --subway'; - $res[1][1]->content = 'Sorry, there is no help text available for this parameter.'; - - $res[2][0]->content = '-y / --yank'; - $res[2][1]->content = 'Some even more stupid, but somewhat longer long describtion.'; - - $res[3][0]->content = '-e / --edit'; - $res[3][1]->content = 'Sorry, there is no help text available for this parameter.'; - - $table = new ezcConsoleTable( $output, 80 ); - $table = $this->input->getHelpTable( $table, true, array( 't', 'subway', 'yank', 'e' ) ); - $this->assertEquals( - $res, - $table, - 'Help table not generated correctly.' - ); - } - - public function testGetHelpTableDefaultParameters() - { - $output = new ezcConsoleOutput(); - - $res = new ezcConsoleTable( $output, 80 ); - $res[0][0]->content = '-t / --testing'; - $res[0][1]->content = 'Sorry, there is no help text available for this parameter.'; - - $res[1][0]->content = '-s / --subway'; - $res[1][1]->content = 'Sorry, there is no help text available for this parameter.'; - - $res[2][0]->content = '-y / --yank'; - $res[2][1]->content = 'Some even more stupid, but somewhat longer long describtion.'; - - $res[3][0]->content = '-e / --edit'; - $res[3][1]->content = 'Sorry, there is no help text available for this parameter.'; - - $table = new ezcConsoleTable( $output, 80 ); - $table = $this->input->getHelpTable( $table ); - - $this->assertEquals( 11, sizeof( $table ), "Expected 11 elements in the generated HelpTable" ); - } - - - - public function testGetHelpText() - { - $res = <<] [-e] [[--] ] -Lala - --y / --yank Some - even - more - stupid, - but - somewhat - longer - long - describtion. --e / --edit Sorry, - there - is no - help - text - available - for - this - parameter. - -EOF; - $this->assertEquals( - $res, - $this->input->getHelpText( 'Lala', 20, true, array( 'e', 'y' ) ), - 'Help text not generated correctly.' - ); - } - - public function testGetSynopsis1() - { - $this->assertEquals( - '$ '.$_SERVER['argv'][0].' [-t] [-s] [-o ] [[--] ]', - $this->input->getSynopsis( array( 't', 's', 'o' ) ), - 'Program synopsis not generated correctly.' - ); - } - - /** - * Tests bug #7923. - * - * @return void - */ - public function testGetSynopsis2() - { - $this->assertEquals( - '$ '.$_SERVER['argv'][0].' [-t] [-s] [-v] [[--] ]', - $this->input->getSynopsis( array( 't', 's', 'v' ) ), - 'Program synopsis not generated correctly.' - ); - } - - private function commonProcessTestSuccess( $args, $res ) - { - try - { - $this->input->process( $args ); - } - catch ( ezcConsoleException $e ) - { - $this->fail( $e->getMessage() ); - return; - } - $values = $this->input->getOptionValues(); - $this->assertTrue( count( array_diff( $res, $values ) ) == 0, 'Parameters processed incorrectly.' ); - } - - private function commonProcessTestFailure( $args, $exceptionClass ) - { - try - { - $this->input->process( $args ); - } - catch ( ezcConsoleException $e ) - { - $this->assertSame( - $exceptionClass, - get_class( $e ), - 'Wrong exception thrown for invalid parameter submission. Expected class <'.$exceptionClass.'>, received <'.get_class( $e ).'>' - ); - return; - } - $this->fail( 'Exception not thrown for invalid parameter submition.' ); - } - - private function argumentsProcessTestSuccess( $args, $res ) - { - try - { - $this->input->process( $args ); - } - catch ( ezcConsoleException $e ) - { - $this->fail( $e->getMessage() ); - return; - } - $this->assertEquals( - $res, - $this->input->getArguments(), - 'Arguments not parsed correctly.' - ); - } -} -?> + 't', + 'long' => 'testing', + 'options' => array(), + ), + array( + 'short' => 's', + 'long' => 'subway', + 'options' => array(), + ), + array( + 'short' => '', + 'long' => 'carry', + 'options' => array(), + ), + array( + 'short' => 'v', + 'long' => 'visual', + 'options' => array( + 'multiple' => true, + 'arguments' => false, + ), + ), + array( + 'short' => 'o', + 'long' => 'original', + 'options' => array( + 'type' => ezcConsoleInput::TYPE_STRING, + ), + ), + array( + 'short' => 'b', + 'long' => 'build', + 'options' => array( + 'type' => ezcConsoleInput::TYPE_INT, + 'default' => 42, + ), + ), + array( + 'short' => 'd', + 'long' => 'destroy', + 'options' => array( + 'type' => ezcConsoleInput::TYPE_STRING, + 'default' => 'world', + ), + ), + array( + 'short' => 'y', + 'long' => 'yank', + 'options' => array( + 'type' => ezcConsoleInput::TYPE_STRING, + 'multiple' => true, + 'shorthelp' => 'Some stupid short text.', + 'longhelp' => 'Some even more stupid, but somewhat longer long describtion.', + ), + ), + array( + 'short' => 'c', + 'long' => 'console', + 'options' => array( + 'shorthelp' => 'Some stupid short text.', + 'longhelp' => 'Some even more stupid, but somewhat longer long describtion.', + 'depends' => array( 't', 'o', 'b', 'y' ), + ), + ), + array( + 'short' => 'e', + 'long' => 'edit', + 'options' => array( + 'excludes' => array( 't', 'y' ), + 'arguments' => false, + ), + ), + array( + 'short' => 'n', + 'long' => 'new', + 'options' => array( + 'depends' => array( 't', 'o' ), + 'excludes' => array( 'b', 'y' ), + 'arguments' => false, + ), + ), + ); + + private $testAliasesSuccess = array( + array( + 'short' => 'k', + 'long' => 'kelvin', + 'ref' => 't', + ), + array( + 'short' => 'f', + 'long' => 'foobar', + 'ref' => 'o', + ), + ); + + private $testAliasesFailure = array( + array( + 'short' => 'l', + 'long' => 'lurking', + 'ref' => 'x', + ), + array( + 'short' => 'e', + 'long' => 'elvis', + 'ref' => 'z', + ), + ); + + private $testArgsSuccess = array( + array( + 'foo.php', + '-o', + '"Test string2"', + '--build', + '42', + ), + array( + 'foo.php', + '-b', + '42', + '--yank', + '"a"', + '--yank', + '"b"', + '--yank', + '"c"', + ), + array( + 'foo.php', + '--yank=a', + '--yank=b', + '--yank="c"', + '-y', + '1', + '-y', + '2' + ), + array( + 'foo.php', + '--yank=a', + '--yank=b', + '-y', + '1', + 'arg1', + 'arg2', + ), + ); + + public static function suite() + { + return new PHPUnit_Framework_TestSuite("ezcConsoleToolsInputTest"); + } + + protected function setUp() + { + $this->input = new ezcConsoleInput(); + foreach ($this->testOptions as $paramData) { + $this->input->registerOption($this->createFakeOption($paramData)); + } + } + + protected function createFakeOption($paramData) + { + $param = new ezcConsoleOption($paramData['short'], $paramData['long']); + foreach ($paramData['options'] as $name => $val) { + if ($name === 'depends') { + foreach ($val as $dep) { + $param->addDependency(new ezcConsoleOptionRule($this->input->getOption($dep))); + } + continue; + } + if ($name === 'excludes') { + foreach ($val as $dep) { + $param->addExclusion(new ezcConsoleOptionRule($this->input->getOption($dep))); + } + continue; + } + $param->$name = $val; + } + return $param; + } + + protected function tearDown() + { + unset($this->input); + } + + public function testRegisterParam() + { + $input = new ezcConsoleInput(); + foreach ($this->testOptions as $optionData) { + $option = $this->createFakeOption($optionData); + $input->registerOption($option); + if ($option->short !== '') { + $this->assertEquals( + $option, + $input->getOption($optionData['short']), + 'Parameter not registered correctly with short name <' . $optionData['short'] . '>.' + ); + } + $this->assertEquals( + $option, + $input->getOption($optionData['long']), + 'Parameter not registered correctly with long name <' . $optionData['long'] . '>.' + ); + } + } + + public function testFromString() + { + $param = new ezcConsoleInput(); + $param->registerOptionString('[a:|all:][u?|user?][i|info][o+test|overall+]'); + $res['a'] = new ezcConsoleOption( + 'a', + 'all', + ezcConsoleInput::TYPE_NONE, + null, + false, + 'No help available.', + 'Sorry, there is no help text available for this parameter.', + array(), + array (), + true + ); + $res['u'] = new ezcConsoleOption( + 'u', + 'user', + ezcConsoleInput::TYPE_STRING, + '', + false, + 'No help available.', + 'Sorry, there is no help text available for this parameter.', + array (), + array (), + true + ); + $res['o'] = new ezcConsoleOption( + 'o', + 'overall', + ezcConsoleInput::TYPE_STRING, + 'test', + true, + 'No help available.', + 'Sorry, there is no help text available for this parameter.', + array (), + array (), + true + ); + $this->assertEquals($res['a'], $param->getOption('a'), 'Parameter -a not registered correctly.'); + $this->assertEquals($res['u'], $param->getOption('u'), 'Parameter -u not registered correctly.'); + $this->assertEquals($res['o'], $param->getOption('o'), 'Parameter -o not registered correctly.'); + } + + /** + * testRegisterAliasSuccess + * + * @access public + */ + public function testRegisterAliasSuccess() + { + $validParams = array(); + foreach ($this->input->getOptions() as $param) { + $validParams[$param->short] = $param; + } + foreach ($this->testAliasesSuccess as $alias) { + try { + $this->input->registerAlias($alias['short'], $alias['long'], $validParams[$alias['ref']]); + } catch (ezcConsoleException $e) { + $this->fail($e->getMessage()); + } + } + } + + /** + * testRegisterAliasFailure + * + * @access public + */ + public function testRegisterAliasFailure() + { + $exceptionCount = 0; + foreach ($this->testAliasesFailure as $alias) { + try { + $this->input->registerAlias($alias['short'], $alias['long'], new ezcConsoleOption('foo', 'bar')); + } catch (ezcConsoleOptionNotExistsException $e) { + $exceptionCount++; + } + } + // Expect every test data set to fail + $this->assertEquals( + $exceptionCount, + count($this->testAliasesFailure), + 'Alias registration succeded for ' . ( count($this->testAliasesFailure) - $exceptionCount ) . ' unkown parameters.' + ); + } + + // Single parameter tests + public function testProcessSuccessSingleShortNoValue() + { + $args = array( + 'foo.php', + '-t', + ); + $res = array( + 't' => true, + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessSingleShortValue() + { + $args = array( + 'foo.php', + '-o', + 'bar' + ); + $res = array( + 'o' => 'bar', + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessSingleLongNoValue() + { + $args = array( + 'foo.php', + '--testing', + ); + $res = array( + 't' => true, + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessSingleLongValue() + { + $args = array( + 'foo.php', + '--original', + 'bar' + ); + $res = array( + 'o' => 'bar', + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessFailureSingleShortDefault() + { + $args = array( + 'foo.php', + '-b' + ); + $res = array( + 'b' => 42, + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionMissingValueException'); + } + + + public function testProcessFailureSingleLongDefault() + { + $args = array( + 'foo.php', + '--build' + ); + $res = array( + 'b' => 42, + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionMissingValueException'); + } + + + public function testProcessSuccessSingleShortNoValueArguments() + { + $args = array( + 'foo.php', + '-s', + '--', + '-foo', + '--bar', + 'baz', + ); + $res = array( + 's' => true, + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessSingleLongNoValueArguments() + { + $args = array( + 'foo.php', + '--subway', + '--', + '-foo', + '--bar', + 'baz', + ); + $res = array( + 's' => true, + ); + $this->commonProcessTestSuccess($args, $res); + } + + // Multiple parameter tests + public function testProcessSuccessMultipleShortNoValue() + { + $args = array( + 'foo.php', + '-t', + '-s', + ); + $res = array( + 't' => true, + 's' => true, + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessMultipleShortValue() + { + $args = array( + 'foo.php', + '-o', + 'bar', + '-b', + '23' + ); + $res = array( + 'o' => 'bar', + 'b' => 23, + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessMultipleLongNoValue() + { + $args = array( + 'foo.php', + '--testing', + '--subway', + ); + $res = array( + 't' => true, + 's' => true, + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessMultipleLongValue() + { + $args = array( + 'foo.php', + '--original', + 'bar', + '--build', + '23', + ); + $res = array( + 'o' => 'bar', + 'b' => 23, + ); + $this->commonProcessTestSuccess($args, $res); + } + + + public function testProcessFailureMultipleShortDefault() + { + $args = array( + 'foo.php', + '-b', + '-d', + ); + $res = array( + 'b' => 42, + 'd' => 'world', + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionMissingValueException'); + } + + public function testProcessFailureMultipleLongDefault() + { + $args = array( + 'foo.php', + '--build', + '--destroy', + ); + $res = array( + 'b' => 42, + 'd' => 'world', + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionMissingValueException'); + } + + // Bug #8645: Default values not set correctly in ezcConsoleInput + public function testProcessSuccessDefault() + { + $args = array( + 'foo.php', + ); + $res = array( + 'b' => 42, + 'd' => 'world', + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessMultipleLongSameNoValue() + { + $args = array( + 'foo.php', + '--visual', + '--visual', + ); + $res = array( + 'v' => array( true, true ), + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessArguments_1() + { + $args = array( + 'foo.php', + '--original', + 'bar', + '--build', + '23', + 'argument', + '1', + '2', + ); + $res = array( + 0 => 'argument', + 1 => '1', + 2 => '2', + ); + $this->argumentsProcessTestSuccess($args, $res); + } + + public function testProcessSuccessDependencies() + { + $args = array( + 'foo.php', + '-t', + '-o', + 'bar', + '--build', + 23, + '-y', + 'text', + '--yank', + 'moretext', + '-c' // This one depends on -t, -o, -b and -y + ); + $res = array( + 't' => true, + 'o' => 'bar', + 'b' => 23, + 'y' => array( + 'text', + 'moretext' + ), + 'c' => true, + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessExclusions() + { + $args = array( + 'foo.php', + '-o', + 'bar', + '--build', + 23, + '--edit' // This one exclude -t and -y + ); + $res = array( + 'o' => 'bar', + 'b' => 23, + 'e' => true, + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessDependenciesExclusions() + { + $args = array( + 'foo.php', + '-t', + '-o', + 'bar', + '-n' // This one depends on -t and -o, but excludes -b and -y + ); + $res = array( + 't' => true, + 'o' => 'bar', + 'n' => true, + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessMandatory() + { + $args = array( + 'foo.php', + '-q', + ); + $this->input->registerOption( + $this->createFakeOption( + array( + 'short' => 'q', + 'long' => 'quite', + 'options' => array( + 'mandatory' => true, + ), + ) + ) + ); + $res = array( + 'q' => true, + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessMandatoryDefault() + { + $args = array( + 'foo.php', + '-q', + ); + $this->input->registerOption( + $this->createFakeOption( + array( + 'short' => 'q', + 'long' => 'quite', + 'options' => array( + 'default' => 'test', + 'mandatory' => true, + ), + ) + ) + ); + $res = array( + 'q' => true, + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessSuccessHelp() + { + $args = array( + 'foo.php', + '-h', + ); + $this->input->registerOption( + $this->createFakeOption( + array( + 'short' => 'q', + 'long' => 'quite', + 'options' => array( + 'mandatory' => true, + ), + ) + ) + ); + $this->input->registerOption( + $this->createFakeOption( + array( + 'short' => 'h', + 'long' => 'help', + 'options' => array( + 'isHelpOption' => true, + ), + ) + ) + ); + $res = array( + 'h' => true, + ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessFailureExistance_1() + { + $args = array( + 'foo.php', + '-q', + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionNotExistsException'); + } + + public function testProcessFailureExistance_2() + { + $args = array( + 'foo.php', + '-tools', + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionNotExistsException'); + } + + public function testProcessFailureExistance_3() + { + $args = array( + 'foo.php', + '-testingaeiou', + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionNotExistsException'); + } + + public function testProcessFailureTypeInt() + { + $args = array( + 'foo.php', + '-b', + 'not_an_int' + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionTypeViolationException'); + } + + // Bug #9046: New bug: [ConsoleTools] Last argument not treated invalid option value + public function testProcessNoFailureTypeNone() + { + $args = array( + 'foo.php', + '-s', + 'a_parameter' + ); + $res = array( "s" => true ); + $this->commonProcessTestSuccess($args, $res); + } + + public function testProcessFailureTypeNone() + { + $args = array( + 'foo.php', + '-s', + 'a_parameter', + 'another_parameter' + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionTypeViolationException'); + } + + public function testProcessFailureNovalue() + { + $args = array( + 'foo.php', + '-o', + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionMissingValueException'); + } + + public function testProcessFailureMultiple() + { + $args = array( + 'foo.php', + '-d', + 'mars', + '--destroy', + 'venus', + + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionTooManyValuesException'); + } + + public function testProcessFailureDependencies() + { + $args = array( + 'foo.php', + '-t', +// '-o', +// 'bar', + '--build', + 23, + '-y', + 'text', + '--yank', + 'moretext', + '-c' // This one depends on -t, -o, -b and -y + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionDependencyViolationException'); + } + + public function testProcessFailureExclusions() + { + $args = array( + 'foo.php', + '-t', + '-o', + 'bar', + '--build', + 23, + '--edit' // This one excludes -t and -y + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionExclusionViolationException'); + } + + public function testProcessFailureArguments() + { + $args = array( + 'foo.php', + '-t', + '--visual', // This one forbids arguments + '-o', + 'bar', + 'someargument', + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionArgumentsViolationException'); + } + + public function testProcessFailureMandatory() + { + $args = array( + 'foo.php', + '-s', + ); + $this->input->registerOption( + $this->createFakeOption( + array( + 'short' => 'q', + 'long' => 'quite', + 'options' => array( + 'mandatory' => true, + ), + ) + ) + ); + $this->commonProcessTestFailure($args, 'ezcConsoleOptionMandatoryViolationException'); + } + + public function testGetHelp1() + { + $res = array( + array( + '-t / --testing', + 'No help available.', + ), + array( + '-s / --subway', + 'No help available.', + ), + array( + '--carry', + 'No help available.', + ), + array( + '-v / --visual', + 'No help available.', + ), + array( + '-o / --original', + 'No help available.', + ), + array( + '-b / --build', + 'No help available.', + ), + array( + '-d / --destroy', + 'No help available.', + ), + array( + '-y / --yank', + 'Some stupid short text.', + ), + array( + '-c / --console', + 'Some stupid short text.', + ), + array( + '-e / --edit', + 'No help available.', + ), + array( + '-n / --new', + 'No help available.', + ), + ); + $this->assertEquals( + $res, + $this->input->getHelp(), + 'Help array was not generated correctly.' + ); + } + + public function testGetHelp2() + { + $res = array( + array( + '-t / --testing', + 'Sorry, there is no help text available for this parameter.', + ), + array( + '-s / --subway', + 'Sorry, there is no help text available for this parameter.', + ), + array( + '--carry', + 'Sorry, there is no help text available for this parameter.', + ), + array( + '-v / --visual', + 'Sorry, there is no help text available for this parameter.', + ), + array( + '-o / --original', + 'Sorry, there is no help text available for this parameter.', + ), + array( + '-b / --build', + 'Sorry, there is no help text available for this parameter.', + ), + array( + '-d / --destroy', + 'Sorry, there is no help text available for this parameter.', + ), + array( + '-y / --yank', + 'Some even more stupid, but somewhat longer long describtion.', + ), + array( + '-c / --console', + 'Some even more stupid, but somewhat longer long describtion.', + ), + array( + '-e / --edit', + 'Sorry, there is no help text available for this parameter.', + ), + array( + '-n / --new', + 'Sorry, there is no help text available for this parameter.', + ), + ); + $this->assertEquals( + $res, + $this->input->getHelp(true), + 'Help array was not generated correctly.' + ); + } + + public function testGetHelp3() + { + $res = array( + array( + '-t / --testing', + 'No help available.', + ), + array( + '-s / --subway', + 'No help available.', + ), + array( + '-v / --visual', + 'No help available.', + ), + ); + $this->assertEquals( + $res, + $this->input->getHelp(false, array( 't', 's', 'v' )), + 'Help array was not generated correctly.' + ); + } + + public function testGetHelp4() + { + $res = array( + array( + '-t / --testing', + 'Sorry, there is no help text available for this parameter.', + ), + array( + '-s / --subway', + 'Sorry, there is no help text available for this parameter.', + ), + array( + '-y / --yank', + 'Some even more stupid, but somewhat longer long describtion.', + ), + array( + '-e / --edit', + 'Sorry, there is no help text available for this parameter.', + ), + array( + '-n / --new', + 'Sorry, there is no help text available for this parameter.', + ), + ); + $this->assertEquals( + $res, + $this->input->getHelp(true, array( 't', 'subway', 'yank', 'e', 'n' )), + 'Help array was not generated correctly.' + ); + } + + public function testGetSynopsis() + { + $this->assertEquals( + '$ '.$_SERVER['argv'][0].' [-t] [-s] [--carry] [-v] [-o ] [-b 42] [-d "world"] [-y ] [-c] [-e] [-n] [[--] ]', + $this->input->getSynopsis(), + 'Program synopsis not generated correctly.' + ); + } + + public function testGetHelpTable() + { + $output = new ezcConsoleOutput(); + + $res = new ezcConsoleTable($output, 80); + $res[0][0]->content = '-t / --testing'; + $res[0][1]->content = 'Sorry, there is no help text available for this parameter.'; + + $res[1][0]->content = '-s / --subway'; + $res[1][1]->content = 'Sorry, there is no help text available for this parameter.'; + + $res[2][0]->content = '-y / --yank'; + $res[2][1]->content = 'Some even more stupid, but somewhat longer long describtion.'; + + $res[3][0]->content = '-e / --edit'; + $res[3][1]->content = 'Sorry, there is no help text available for this parameter.'; + + $table = new ezcConsoleTable($output, 80); + $table = $this->input->getHelpTable($table, true, array( 't', 'subway', 'yank', 'e' )); + $this->assertEquals( + $res, + $table, + 'Help table not generated correctly.' + ); + } + + public function testGetHelpTableDefaultParameters() + { + $output = new ezcConsoleOutput(); + + $res = new ezcConsoleTable($output, 80); + $res[0][0]->content = '-t / --testing'; + $res[0][1]->content = 'Sorry, there is no help text available for this parameter.'; + + $res[1][0]->content = '-s / --subway'; + $res[1][1]->content = 'Sorry, there is no help text available for this parameter.'; + + $res[2][0]->content = '-y / --yank'; + $res[2][1]->content = 'Some even more stupid, but somewhat longer long describtion.'; + + $res[3][0]->content = '-e / --edit'; + $res[3][1]->content = 'Sorry, there is no help text available for this parameter.'; + + $table = new ezcConsoleTable($output, 80); + $table = $this->input->getHelpTable($table); + + $this->assertEquals(11, sizeof($table), "Expected 11 elements in the generated HelpTable"); + } + + + + public function testGetHelpText() + { + $res = <<] [-e] [[--] ] +Lala + +-y / --yank Some + even + more + stupid, + but + somewhat + longer + long + describtion. +-e / --edit Sorry, + there + is no + help + text + available + for + this + parameter. + +EOF; + $this->assertEquals( + $res, + $this->input->getHelpText('Lala', 20, true, array( 'e', 'y' )), + 'Help text not generated correctly.' + ); + } + + public function testGetSynopsis1() + { + $this->assertEquals( + '$ '.$_SERVER['argv'][0].' [-t] [-s] [-o ] [[--] ]', + $this->input->getSynopsis(array( 't', 's', 'o' )), + 'Program synopsis not generated correctly.' + ); + } + + /** + * Tests bug #7923. + * + * @return void + */ + public function testGetSynopsis2() + { + $this->assertEquals( + '$ '.$_SERVER['argv'][0].' [-t] [-s] [-v] [[--] ]', + $this->input->getSynopsis(array( 't', 's', 'v' )), + 'Program synopsis not generated correctly.' + ); + } + + private function commonProcessTestSuccess($args, $res) + { + try { + $this->input->process($args); + } catch (ezcConsoleException $e) { + $this->fail($e->getMessage()); + return; + } + $values = $this->input->getOptionValues(); + $this->assertTrue(count(array_diff($res, $values)) == 0, 'Parameters processed incorrectly.'); + } + + private function commonProcessTestFailure($args, $exceptionClass) + { + try { + $this->input->process($args); + } catch (ezcConsoleException $e) { + $this->assertSame( + $exceptionClass, + get_class($e), + 'Wrong exception thrown for invalid parameter submission. Expected class <'.$exceptionClass.'>, received <'.get_class($e).'>' + ); + return; + } + $this->fail('Exception not thrown for invalid parameter submition.'); + } + + private function argumentsProcessTestSuccess($args, $res) + { + try { + $this->input->process($args); + } catch (ezcConsoleException $e) { + $this->fail($e->getMessage()); + return; + } + $this->assertEquals( + $res, + $this->input->getArguments(), + 'Arguments not parsed correctly.' + ); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/option_rule_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/option_rule_test.php index 83ccb51a0e62762206a049f8ce1c73b1cfbc63b5..b1fcdea9c9585d37670add4aaff42bc63ad036df 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/option_rule_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/option_rule_test.php @@ -1,130 +1,115 @@ -assertSame( $option, $rule->option ); - $this->assertEquals( array( "a", "b", "c" ), $rule->values ); - } - - public function testGetAccessFailure() - { - $option = new ezcConsoleOption( "a", "aaa" ); - $rule = new ezcConsoleOptionRule( $option, array( "a", "b", "c" ) ); - - try - { - $foo = $rule->nonExistent; - } - catch ( ezcBasePropertyNotFoundException $e ) - { - return true; - } - $this->fail( "Exception not thrown on access of invalid property." ); - } - - public function testSetAccessSuccess() - { - $option = new ezcConsoleOption( "a", "aaa" ); - $rule = new ezcConsoleOptionRule( $option, array( "a" ) ); - - $rule->option = $option; - $rule->values = array( "a", "b", "c" ); - - $this->assertSame( $option, $rule->option ); - $this->assertEquals( array( "a", "b", "c" ), $rule->values ); - } - - public function testSetAccessFailureOption() - { - $option = new ezcConsoleOption( "a", "aaa" ); - $rule = new ezcConsoleOptionRule( $option, array( "a" ) ); - - try - { - $rule->option = array(); - } - catch ( ezcBaseValueException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOptionRule->option." ); - } - - public function testSetAccessFailureValues() - { - $option = new ezcConsoleOption( "a", "aaa" ); - $rule = new ezcConsoleOptionRule( $option, array( "a" ) ); - - try - { - $rule->values = 23; - } - catch ( ezcBaseValueException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOptionRule->values." ); - } - - public function testSetAccessFailureNonExsitent() - { - $option = new ezcConsoleOption( "a", "aaa" ); - $rule = new ezcConsoleOptionRule( $option, array( "a" ) ); - - try - { - $rule->nonExistent = 23; - } - catch ( ezcBasePropertyNotFoundException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOptionRule->nonExistent." ); - } - - public function testIssetAccessSuccess() - { - $option = new ezcConsoleOption( "a", "aaa" ); - $rule = new ezcConsoleOptionRule( $option, array( "a" ) ); - - $this->assertTrue( isset( $rule->option ) ); - $this->assertTrue( isset( $rule->values ) ); - } - - public function testIssetAccessFailure() - { - $option = new ezcConsoleOption( "a", "aaa" ); - $rule = new ezcConsoleOptionRule( $option, array( "a" ) ); - - $this->assertFalse( isset( $rule->nonExsistent ) ); - } - -} - -?> +assertSame($option, $rule->option); + $this->assertEquals(array( "a", "b", "c" ), $rule->values); + } + + public function testGetAccessFailure() + { + $option = new ezcConsoleOption("a", "aaa"); + $rule = new ezcConsoleOptionRule($option, array( "a", "b", "c" )); + + try { + $foo = $rule->nonExistent; + } catch (ezcBasePropertyNotFoundException $e) { + return true; + } + $this->fail("Exception not thrown on access of invalid property."); + } + + public function testSetAccessSuccess() + { + $option = new ezcConsoleOption("a", "aaa"); + $rule = new ezcConsoleOptionRule($option, array( "a" )); + + $rule->option = $option; + $rule->values = array( "a", "b", "c" ); + + $this->assertSame($option, $rule->option); + $this->assertEquals(array( "a", "b", "c" ), $rule->values); + } + + public function testSetAccessFailureOption() + { + $option = new ezcConsoleOption("a", "aaa"); + $rule = new ezcConsoleOptionRule($option, array( "a" )); + + try { + $rule->option = array(); + } catch (ezcBaseValueException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOptionRule->option."); + } + + public function testSetAccessFailureValues() + { + $option = new ezcConsoleOption("a", "aaa"); + $rule = new ezcConsoleOptionRule($option, array( "a" )); + + try { + $rule->values = 23; + } catch (ezcBaseValueException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOptionRule->values."); + } + + public function testSetAccessFailureNonExsitent() + { + $option = new ezcConsoleOption("a", "aaa"); + $rule = new ezcConsoleOptionRule($option, array( "a" )); + + try { + $rule->nonExistent = 23; + } catch (ezcBasePropertyNotFoundException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOptionRule->nonExistent."); + } + + public function testIssetAccessSuccess() + { + $option = new ezcConsoleOption("a", "aaa"); + $rule = new ezcConsoleOptionRule($option, array( "a" )); + + $this->assertTrue(isset($rule->option)); + $this->assertTrue(isset($rule->values)); + } + + public function testIssetAccessFailure() + { + $option = new ezcConsoleOption("a", "aaa"); + $rule = new ezcConsoleOptionRule($option, array( "a" )); + + $this->assertFalse(isset($rule->nonExsistent)); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/option_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/option_test.php index 305b6997d83e1cbb19a4be6cee6538dc5eb19dd8..8615518b8245a3dea39af52d241e9400a7459027 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/option_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/option_test.php @@ -1,655 +1,618 @@ -assertEquals( $option->short, "a" ); - $this->assertEquals( $option->long, "aaa" ); - $this->assertEquals( ezcConsoleInput::TYPE_INT, $option->type ); - $this->assertEquals( 23, $option->default ); - $this->assertTrue( $option->multiple ); - $this->assertEquals( "Shorthelp", $option->shorthelp ); - $this->assertEquals( "Longhelp", $option->longhelp ); - $this->assertEquals( array( $ruleDependency ), $option->getDependencies() ); - $this->assertEquals( array( $ruleExclusion ), $option->getExclusions() ); - $this->assertFalse( $option->arguments ); - $this->assertTrue( $option->mandatory ); - $this->assertTrue( $option->isHelpOption ); - } - - public function testInvalidOptionName_short() - { - try - { - $option = new ezcConsoleOption( ' ', 'help' ); - } - catch ( ezcConsoleInvalidOptionNameException $e ) - { - return; - } - $this->fail( 'Exception not thrown on invalid option name.' ); - } - - public function testInvalidOptionName_long() - { - try - { - $option = new ezcConsoleOption( 'h', '--help' ); - } - catch ( ezcConsoleInvalidOptionNameException $e ) - { - return; - } - $this->fail( 'Exception not thrown on invalid option name.' ); - } - - - public function testAddDependency() - { - $option_1 = new ezcConsoleOption( - "a", - "aaa" - ); - $option_2 = new ezcConsoleOption( - "b", - "bbb" - ); - - $rule = new ezcConsoleOptionRule( - $option_2, array( "c" ) - ); - - $option_1->addDependency( $rule ); - $option_1->addDependency( $rule ); - - $this->assertAttributeEquals( - array( $rule ), - "dependencies", - $option_1 - ); - } - - public function testRemoveDependency() - { - $option_1 = new ezcConsoleOption( - "a", - "aaa" - ); - $option_2 = new ezcConsoleOption( - "b", - "bbb" - ); - - $rule = new ezcConsoleOptionRule( - $option_2, array( "c" ) - ); - - $option_1->addDependency( $rule ); - $option_1->removeDependency( $rule ); - - $this->assertAttributeEquals( - array(), - "dependencies", - $option_1 - ); - } - - // Bug #9052: Exception because of invalid property in ezcConsoleOption - public function testRemoveAllDependencies() - { - $option_1 = new ezcConsoleOption( - "a", - "aaa" - ); - $option_2 = new ezcConsoleOption( - "b", - "bbb" - ); - - $rule_1 = new ezcConsoleOptionRule( - $option_2, array( "c" ) - ); - - $rule_2 = new ezcConsoleOptionRule( - $option_2, array( "d" ) - ); - - $option_1->addDependency( $rule_1 ); - $option_1->addDependency( $rule_2 ); - $option_1->removeAllDependencies( $option_2 ); - - $this->assertAttributeEquals( - array(), - "dependencies", - $option_1 - ); - } - - // Bug #9052: Exception because of invalid property in ezcConsoleOption - public function testHasDependencySuccess() - { - $option_1 = new ezcConsoleOption( - "a", - "aaa" - ); - $option_2 = new ezcConsoleOption( - "b", - "bbb" - ); - - $rule = new ezcConsoleOptionRule( - $option_2, array( "c" ) - ); - - $option_1->addDependency( $rule ); - - $this->assertTrue( - $option_1->hasDependency( $option_2 ) - ); - } - - public function testHasDependencyFailure() - { - $option_1 = new ezcConsoleOption( - "a", - "aaa" - ); - $option_2 = new ezcConsoleOption( - "b", - "bbb" - ); - - $rule = new ezcConsoleOptionRule( - $option_2, array( "c" ) - ); - - $this->assertFalse( - $option_1->hasDependency( $option_2 ) - ); - } - - public function testResetDependencies() - { - $option_1 = new ezcConsoleOption( - "a", - "aaa" - ); - $option_2 = new ezcConsoleOption( - "b", - "bbb" - ); - - $rule = new ezcConsoleOptionRule( - $option_2, array( "c" ) - ); - - $option_1->addDependency( $rule ); - $option_1->resetDependencies(); - - $this->assertAttributeEquals( - array(), - "dependencies", - $option_1 - ); - } - - public function testAddExclusion() - { - $option_1 = new ezcConsoleOption( - "a", - "aaa" - ); - $option_2 = new ezcConsoleOption( - "b", - "bbb" - ); - - $rule = new ezcConsoleOptionRule( - $option_2, array( "c" ) - ); - - $option_1->addExclusion( $rule ); - $option_1->addExclusion( $rule ); - - $this->assertAttributeEquals( - array( $rule ), - "exclusions", - $option_1 - ); - } - - public function testRemoveExclusion() - { - $option_1 = new ezcConsoleOption( - "a", - "aaa" - ); - $option_2 = new ezcConsoleOption( - "b", - "bbb" - ); - - $rule = new ezcConsoleOptionRule( - $option_2, array( "c" ) - ); - - $option_1->addExclusion( $rule ); - $option_1->removeExclusion( $rule ); - - $this->assertAttributeEquals( - array(), - "exclusions", - $option_1 - ); - } - - // Bug #9052: Exception because of invalid property in ezcConsoleOption - public function testRemoveAllExclusions() - { - $option_1 = new ezcConsoleOption( - "a", - "aaa" - ); - $option_2 = new ezcConsoleOption( - "b", - "bbb" - ); - - $rule_1 = new ezcConsoleOptionRule( - $option_2, array( "c" ) - ); - - $rule_2 = new ezcConsoleOptionRule( - $option_2, array( "d" ) - ); - - $option_1->addExclusion( $rule_1 ); - $option_1->addExclusion( $rule_2 ); - $option_1->removeAllExclusions( $option_2 ); - - $this->assertAttributeEquals( - array(), - "exclusions", - $option_1 - ); - } - - // Bug #9052: Exception because of invalid property in ezcConsoleOption - public function testHasExclusionSuccess() - { - $option_1 = new ezcConsoleOption( - "a", - "aaa" - ); - $option_2 = new ezcConsoleOption( - "b", - "bbb" - ); - - $rule = new ezcConsoleOptionRule( - $option_2, array( "c" ) - ); - - $option_1->addExclusion( $rule ); - - $this->assertTrue( - $option_1->hasExclusion( $option_2 ) - ); - } - - public function testHasExclusionFailure() - { - $option_1 = new ezcConsoleOption( - "a", - "aaa" - ); - $option_2 = new ezcConsoleOption( - "b", - "bbb" - ); - - $rule = new ezcConsoleOptionRule( - $option_2, array( "c" ) - ); - - $this->assertFalse( - $option_1->hasExclusion( $option_2 ) - ); - } - - public function testResetExclusions() - { - $option_1 = new ezcConsoleOption( - "a", - "aaa" - ); - $option_2 = new ezcConsoleOption( - "b", - "bbb" - ); - - $rule = new ezcConsoleOptionRule( - $option_2, array( "c" ) - ); - - $option_1->addExclusion( $rule ); - $option_1->resetExclusions(); - - $this->assertAttributeEquals( - array(), - "exclusions", - $option_1 - ); - } - - public function testPropertyGetAccessSuccess() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - $this->assertEquals( "a", $option->short ); - $this->assertEquals( "aaa", $option->long ); - $this->assertEquals( ezcConsoleInput::TYPE_NONE, $option->type ); - $this->assertNull( $option->default ); - $this->assertFalse( $option->multiple ); - $this->assertEquals( "No help available.", $option->shorthelp ); - $this->assertEquals( "Sorry, there is no help text available for this parameter.", $option->longhelp ); - $this->assertTrue( $option->arguments ); - $this->assertFalse( $option->mandatory ); - $this->assertFalse( $option->isHelpOption ); - } - - public function testPropertyGetAccessFailureDependencies() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $foo = $option->dependencies; - } - catch( ezcBasePropertyNotFoundException $e ) - { - return; - } - $this->fail( "Exception not thrown on access of ezcConsoleOption->dependencies." ); - } - - public function testPropertyGetAccessFailureExclusions() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $foo = $option->exclusions; - } - catch( ezcBasePropertyNotFoundException $e ) - { - return; - } - $this->fail( "Exception not thrown on access of ezcConsoleOption->exclusions." ); - } - - public function testPropertyGetAccessFailureNotExisting() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $foo = $option->nonExisting; - } - catch( ezcBasePropertyNotFoundException $e ) - { - return; - } - $this->fail( "Exception not thrown on access of ezcConsoleOption->nonExisting." ); - } - - public function testPropertySetAccessSuccess() - { - $option = new ezcConsoleOption( "a", "aaa" ); - $option->type = ezcConsoleInput::TYPE_STRING; - $option->type = ezcConsoleInput::TYPE_NONE; - $option->type = ezcConsoleInput::TYPE_INT; - $option->default = 10; - $option->multiple = true; - $option->shorthelp = "Shorthelp"; - $option->longhelp = "Longhelp"; - $option->arguments = false; - $option->mandatory = true; - $option->isHelpOption = true; - - $this->assertEquals( ezcConsoleInput::TYPE_INT, $option->type ); - $this->assertEquals( 10, $option->default ); - $this->assertTrue( $option->multiple ); - $this->assertEquals( "Shorthelp", $option->shorthelp ); - $this->assertEquals( "Longhelp", $option->longhelp ); - $this->assertFalse( $option->arguments ); - $this->assertTrue( $option->mandatory ); - $this->assertTrue( $option->isHelpOption ); - } - - public function testPropertySetAccessFailureShort() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $option->short = "b"; - } - catch ( ezcBasePropertyPermissionException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOption->short." ); - } - - public function testPropertySetAccessFailureLong() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $option->long = "bbb"; - } - catch ( ezcBasePropertyPermissionException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOption->long." ); - } - - public function testPropertySetAccessFailureType() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $option->type = "Invalid type"; - } - catch ( ezcBaseValueException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOption->type." ); - } - - public function testPropertySetAccessFailureDefault() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $option->default = array(); - } - catch ( ezcBaseValueException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOption->default." ); - } - - public function testPropertySetAccessFailureMultiple() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $option->multiple = array(); - } - catch ( ezcBaseValueException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOption->multiple." ); - } - - public function testPropertySetAccessFailureShorthelp() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $option->shorthelp = array(); - } - catch ( ezcBaseValueException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOption->shorthelp." ); - } - - public function testPropertySetAccessFailureLonghelp() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $option->longhelp = array(); - } - catch ( ezcBaseValueException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOption->longhelp." ); - } - - public function testPropertySetAccessFailureArguments() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $option->arguments = array(); - } - catch ( ezcBaseValueException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOption->arguments." ); - } - - public function testPropertySetAccessFailureMandatory() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $option->mandatory = array(); - } - catch ( ezcBaseValueException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOption->mandatory." ); - } - - public function testPropertySetAccessFailureIsHelpOption() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $option->isHelpOption = array(); - } - catch ( ezcBaseValueException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOption->isHelpOption." ); - } - - public function testPropertySetAccessFailureNonExistent() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - try - { - $option->nonExistent = array(); - } - catch ( ezcBasePropertyNotFoundException $e ) - { - return; - } - $this->fail( "Exception not thrown on invalid value for ezcConsoleOption->nonExsitent." ); - } - - public function testPropertyIssetAccessSuccess() - { - $option = new ezcConsoleOption( "a", "aaa" ); - - $this->assertTrue( isset( $option->type ) ); - $this->assertFalse( isset( $option->default ) ); - $this->assertTrue( isset( $option->multiple ) ); - $this->assertTrue( isset( $option->shorthelp ) ); - $this->assertTrue( isset( $option->longhelp ) ); - $this->assertTrue( isset( $option->arguments ) ); - $this->assertTrue( isset( $option->mandatory ) ); - $this->assertTrue( isset( $option->isHelpOption ) ); - $this->assertFalse( isset( $option->nonExistent ) ); - - } -} - -?> +assertEquals($option->short, "a"); + $this->assertEquals($option->long, "aaa"); + $this->assertEquals(ezcConsoleInput::TYPE_INT, $option->type); + $this->assertEquals(23, $option->default); + $this->assertTrue($option->multiple); + $this->assertEquals("Shorthelp", $option->shorthelp); + $this->assertEquals("Longhelp", $option->longhelp); + $this->assertEquals(array( $ruleDependency ), $option->getDependencies()); + $this->assertEquals(array( $ruleExclusion ), $option->getExclusions()); + $this->assertFalse($option->arguments); + $this->assertTrue($option->mandatory); + $this->assertTrue($option->isHelpOption); + } + + public function testInvalidOptionName_short() + { + try { + $option = new ezcConsoleOption(' ', 'help'); + } catch (ezcConsoleInvalidOptionNameException $e) { + return; + } + $this->fail('Exception not thrown on invalid option name.'); + } + + public function testInvalidOptionName_long() + { + try { + $option = new ezcConsoleOption('h', '--help'); + } catch (ezcConsoleInvalidOptionNameException $e) { + return; + } + $this->fail('Exception not thrown on invalid option name.'); + } + + + public function testAddDependency() + { + $option_1 = new ezcConsoleOption( + "a", + "aaa" + ); + $option_2 = new ezcConsoleOption( + "b", + "bbb" + ); + + $rule = new ezcConsoleOptionRule( + $option_2, + array( "c" ) + ); + + $option_1->addDependency($rule); + $option_1->addDependency($rule); + + $this->assertAttributeEquals( + array( $rule ), + "dependencies", + $option_1 + ); + } + + public function testRemoveDependency() + { + $option_1 = new ezcConsoleOption( + "a", + "aaa" + ); + $option_2 = new ezcConsoleOption( + "b", + "bbb" + ); + + $rule = new ezcConsoleOptionRule( + $option_2, + array( "c" ) + ); + + $option_1->addDependency($rule); + $option_1->removeDependency($rule); + + $this->assertAttributeEquals( + array(), + "dependencies", + $option_1 + ); + } + + // Bug #9052: Exception because of invalid property in ezcConsoleOption + public function testRemoveAllDependencies() + { + $option_1 = new ezcConsoleOption( + "a", + "aaa" + ); + $option_2 = new ezcConsoleOption( + "b", + "bbb" + ); + + $rule_1 = new ezcConsoleOptionRule( + $option_2, + array( "c" ) + ); + + $rule_2 = new ezcConsoleOptionRule( + $option_2, + array( "d" ) + ); + + $option_1->addDependency($rule_1); + $option_1->addDependency($rule_2); + $option_1->removeAllDependencies($option_2); + + $this->assertAttributeEquals( + array(), + "dependencies", + $option_1 + ); + } + + // Bug #9052: Exception because of invalid property in ezcConsoleOption + public function testHasDependencySuccess() + { + $option_1 = new ezcConsoleOption( + "a", + "aaa" + ); + $option_2 = new ezcConsoleOption( + "b", + "bbb" + ); + + $rule = new ezcConsoleOptionRule( + $option_2, + array( "c" ) + ); + + $option_1->addDependency($rule); + + $this->assertTrue( + $option_1->hasDependency($option_2) + ); + } + + public function testHasDependencyFailure() + { + $option_1 = new ezcConsoleOption( + "a", + "aaa" + ); + $option_2 = new ezcConsoleOption( + "b", + "bbb" + ); + + $rule = new ezcConsoleOptionRule( + $option_2, + array( "c" ) + ); + + $this->assertFalse( + $option_1->hasDependency($option_2) + ); + } + + public function testResetDependencies() + { + $option_1 = new ezcConsoleOption( + "a", + "aaa" + ); + $option_2 = new ezcConsoleOption( + "b", + "bbb" + ); + + $rule = new ezcConsoleOptionRule( + $option_2, + array( "c" ) + ); + + $option_1->addDependency($rule); + $option_1->resetDependencies(); + + $this->assertAttributeEquals( + array(), + "dependencies", + $option_1 + ); + } + + public function testAddExclusion() + { + $option_1 = new ezcConsoleOption( + "a", + "aaa" + ); + $option_2 = new ezcConsoleOption( + "b", + "bbb" + ); + + $rule = new ezcConsoleOptionRule( + $option_2, + array( "c" ) + ); + + $option_1->addExclusion($rule); + $option_1->addExclusion($rule); + + $this->assertAttributeEquals( + array( $rule ), + "exclusions", + $option_1 + ); + } + + public function testRemoveExclusion() + { + $option_1 = new ezcConsoleOption( + "a", + "aaa" + ); + $option_2 = new ezcConsoleOption( + "b", + "bbb" + ); + + $rule = new ezcConsoleOptionRule( + $option_2, + array( "c" ) + ); + + $option_1->addExclusion($rule); + $option_1->removeExclusion($rule); + + $this->assertAttributeEquals( + array(), + "exclusions", + $option_1 + ); + } + + // Bug #9052: Exception because of invalid property in ezcConsoleOption + public function testRemoveAllExclusions() + { + $option_1 = new ezcConsoleOption( + "a", + "aaa" + ); + $option_2 = new ezcConsoleOption( + "b", + "bbb" + ); + + $rule_1 = new ezcConsoleOptionRule( + $option_2, + array( "c" ) + ); + + $rule_2 = new ezcConsoleOptionRule( + $option_2, + array( "d" ) + ); + + $option_1->addExclusion($rule_1); + $option_1->addExclusion($rule_2); + $option_1->removeAllExclusions($option_2); + + $this->assertAttributeEquals( + array(), + "exclusions", + $option_1 + ); + } + + // Bug #9052: Exception because of invalid property in ezcConsoleOption + public function testHasExclusionSuccess() + { + $option_1 = new ezcConsoleOption( + "a", + "aaa" + ); + $option_2 = new ezcConsoleOption( + "b", + "bbb" + ); + + $rule = new ezcConsoleOptionRule( + $option_2, + array( "c" ) + ); + + $option_1->addExclusion($rule); + + $this->assertTrue( + $option_1->hasExclusion($option_2) + ); + } + + public function testHasExclusionFailure() + { + $option_1 = new ezcConsoleOption( + "a", + "aaa" + ); + $option_2 = new ezcConsoleOption( + "b", + "bbb" + ); + + $rule = new ezcConsoleOptionRule( + $option_2, + array( "c" ) + ); + + $this->assertFalse( + $option_1->hasExclusion($option_2) + ); + } + + public function testResetExclusions() + { + $option_1 = new ezcConsoleOption( + "a", + "aaa" + ); + $option_2 = new ezcConsoleOption( + "b", + "bbb" + ); + + $rule = new ezcConsoleOptionRule( + $option_2, + array( "c" ) + ); + + $option_1->addExclusion($rule); + $option_1->resetExclusions(); + + $this->assertAttributeEquals( + array(), + "exclusions", + $option_1 + ); + } + + public function testPropertyGetAccessSuccess() + { + $option = new ezcConsoleOption("a", "aaa"); + + $this->assertEquals("a", $option->short); + $this->assertEquals("aaa", $option->long); + $this->assertEquals(ezcConsoleInput::TYPE_NONE, $option->type); + $this->assertNull($option->default); + $this->assertFalse($option->multiple); + $this->assertEquals("No help available.", $option->shorthelp); + $this->assertEquals("Sorry, there is no help text available for this parameter.", $option->longhelp); + $this->assertTrue($option->arguments); + $this->assertFalse($option->mandatory); + $this->assertFalse($option->isHelpOption); + } + + public function testPropertyGetAccessFailureDependencies() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $foo = $option->dependencies; + } catch (ezcBasePropertyNotFoundException $e) { + return; + } + $this->fail("Exception not thrown on access of ezcConsoleOption->dependencies."); + } + + public function testPropertyGetAccessFailureExclusions() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $foo = $option->exclusions; + } catch (ezcBasePropertyNotFoundException $e) { + return; + } + $this->fail("Exception not thrown on access of ezcConsoleOption->exclusions."); + } + + public function testPropertyGetAccessFailureNotExisting() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $foo = $option->nonExisting; + } catch (ezcBasePropertyNotFoundException $e) { + return; + } + $this->fail("Exception not thrown on access of ezcConsoleOption->nonExisting."); + } + + public function testPropertySetAccessSuccess() + { + $option = new ezcConsoleOption("a", "aaa"); + $option->type = ezcConsoleInput::TYPE_STRING; + $option->type = ezcConsoleInput::TYPE_NONE; + $option->type = ezcConsoleInput::TYPE_INT; + $option->default = 10; + $option->multiple = true; + $option->shorthelp = "Shorthelp"; + $option->longhelp = "Longhelp"; + $option->arguments = false; + $option->mandatory = true; + $option->isHelpOption = true; + + $this->assertEquals(ezcConsoleInput::TYPE_INT, $option->type); + $this->assertEquals(10, $option->default); + $this->assertTrue($option->multiple); + $this->assertEquals("Shorthelp", $option->shorthelp); + $this->assertEquals("Longhelp", $option->longhelp); + $this->assertFalse($option->arguments); + $this->assertTrue($option->mandatory); + $this->assertTrue($option->isHelpOption); + } + + public function testPropertySetAccessFailureShort() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $option->short = "b"; + } catch (ezcBasePropertyPermissionException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOption->short."); + } + + public function testPropertySetAccessFailureLong() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $option->long = "bbb"; + } catch (ezcBasePropertyPermissionException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOption->long."); + } + + public function testPropertySetAccessFailureType() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $option->type = "Invalid type"; + } catch (ezcBaseValueException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOption->type."); + } + + public function testPropertySetAccessFailureDefault() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $option->default = array(); + } catch (ezcBaseValueException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOption->default."); + } + + public function testPropertySetAccessFailureMultiple() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $option->multiple = array(); + } catch (ezcBaseValueException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOption->multiple."); + } + + public function testPropertySetAccessFailureShorthelp() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $option->shorthelp = array(); + } catch (ezcBaseValueException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOption->shorthelp."); + } + + public function testPropertySetAccessFailureLonghelp() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $option->longhelp = array(); + } catch (ezcBaseValueException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOption->longhelp."); + } + + public function testPropertySetAccessFailureArguments() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $option->arguments = array(); + } catch (ezcBaseValueException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOption->arguments."); + } + + public function testPropertySetAccessFailureMandatory() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $option->mandatory = array(); + } catch (ezcBaseValueException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOption->mandatory."); + } + + public function testPropertySetAccessFailureIsHelpOption() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $option->isHelpOption = array(); + } catch (ezcBaseValueException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOption->isHelpOption."); + } + + public function testPropertySetAccessFailureNonExistent() + { + $option = new ezcConsoleOption("a", "aaa"); + + try { + $option->nonExistent = array(); + } catch (ezcBasePropertyNotFoundException $e) { + return; + } + $this->fail("Exception not thrown on invalid value for ezcConsoleOption->nonExsitent."); + } + + public function testPropertyIssetAccessSuccess() + { + $option = new ezcConsoleOption("a", "aaa"); + + $this->assertTrue(isset($option->type)); + $this->assertFalse(isset($option->default)); + $this->assertTrue(isset($option->multiple)); + $this->assertTrue(isset($option->shorthelp)); + $this->assertTrue(isset($option->longhelp)); + $this->assertTrue(isset($option->arguments)); + $this->assertTrue(isset($option->mandatory)); + $this->assertTrue(isset($option->isHelpOption)); + $this->assertFalse(isset($option->nonExistent)); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_format_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_format_test.php index 5e61c12e924a84667f15152b741f2b646a25f2d3..8e6cc39adf07ec46f1433aafe98cfd64bebf0c39 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_format_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_format_test.php @@ -1,176 +1,157 @@ -assertEquals( - $fake, - new ezcConsoleOutputFormat(), - 'Default values incorrect for ezcConsoleOutputFormat.' - ); - } - - public function testGetAccessSuccess() - { - $format = new ezcConsoleOutputFormat( 'blue', - array( 'bold' ), - 'red' - ); - - $this->assertEquals( "blue", $format->color ); - $this->assertEquals( array( "bold" ), $format->style ); - $this->assertEquals( "red", $format->bgcolor ); - } - - public function testGetAccessFailure() - { - $format = new ezcConsoleOutputFormat(); - - try - { - $foo = $format->nonExsitent; - } - catch ( ezcBasePropertyNotFoundException $e ) - { - return true; - } - $this->fail( "Exception not thrown on access of not existing property on ezcConsoleFormat." ); - } - - public function testSetAccessSuccess() - { - $format = new ezcConsoleOutputFormat(); - - $format->color = "blue"; - $format->style = array( "bold" ); - $format->bgcolor = "red"; - - $this->assertEquals( "blue", $format->color ); - $this->assertEquals( array( "bold" ), $format->style ); - $this->assertEquals( "red", $format->bgcolor ); - - // Style can also be scalar - $format->style = "bold"; - $this->assertEquals( array( "bold" ), $format->style ); - } - - public function testSetAccessFailureColor() - { - $format = new ezcConsoleOutputFormat(); - - try - { - $format->color = "nonExistent"; - } - catch ( ezcBaseValueException $e ) - { - return true; - } - $this->fail( "Exception not thrown on set of not existing color on ezcConsoleFormat->color." ); - } - - public function testSetAccessFailureStyleArray() - { - $format = new ezcConsoleOutputFormat(); - - try - { - $format->style = array( "nonExistent" ); - } - catch ( ezcBaseValueException $e ) - { - return true; - } - $this->fail( "Exception not thrown on set of not existing format code as array on ezcConsoleFormat->style." ); - } - - public function testSetAccessFailureStyleScalar() - { - $format = new ezcConsoleOutputFormat(); - - try - { - $format->style = "nonExistent"; - } - catch ( ezcBaseValueException $e ) - { - return true; - } - $this->fail( "Exception not thrown on set of not existing format code as scalar on ezcConsoleFormat->style." ); - } - - public function testSetAccessFailureBgcolor() - { - $format = new ezcConsoleOutputFormat(); - - try - { - $format->bgcolor = "nonExistent"; - } - catch ( ezcBaseValueException $e ) - { - return true; - } - $this->fail( "Exception not thrown on set of not existing color on ezcConsoleFormat->bgcolor." ); - } - - public function testSetAccessFailureNonexistent() - { - $format = new ezcConsoleOutputFormat(); - - try - { - $format->nonExsitent = "nonExistent"; - } - catch ( ezcBasePropertyNotFoundException $e ) - { - return true; - } - $this->fail( "Exception not thrown on set of not existing color on ezcConsoleFormat->bgcolor." ); - } - - public function testIssetAccessSuccess() - { - $format = new ezcConsoleOutputFormat(); - - $this->assertTrue( isset( $format->color ) ); - $this->assertTrue( isset( $format->style ) ); - $this->assertTrue( isset( $format->bgcolor ) ); - } - - public function testIssetAccessFailure() - { - $format = new ezcConsoleOutputFormat(); - - $this->assertFalse( isset( $format->nonExistent ) ); - } -} - -?> +assertEquals( + $fake, + new ezcConsoleOutputFormat(), + 'Default values incorrect for ezcConsoleOutputFormat.' + ); + } + + public function testGetAccessSuccess() + { + $format = new ezcConsoleOutputFormat( + 'blue', + array( 'bold' ), + 'red' + ); + + $this->assertEquals("blue", $format->color); + $this->assertEquals(array( "bold" ), $format->style); + $this->assertEquals("red", $format->bgcolor); + } + + public function testGetAccessFailure() + { + $format = new ezcConsoleOutputFormat(); + + try { + $foo = $format->nonExsitent; + } catch (ezcBasePropertyNotFoundException $e) { + return true; + } + $this->fail("Exception not thrown on access of not existing property on ezcConsoleFormat."); + } + + public function testSetAccessSuccess() + { + $format = new ezcConsoleOutputFormat(); + + $format->color = "blue"; + $format->style = array( "bold" ); + $format->bgcolor = "red"; + + $this->assertEquals("blue", $format->color); + $this->assertEquals(array( "bold" ), $format->style); + $this->assertEquals("red", $format->bgcolor); + + // Style can also be scalar + $format->style = "bold"; + $this->assertEquals(array( "bold" ), $format->style); + } + + public function testSetAccessFailureColor() + { + $format = new ezcConsoleOutputFormat(); + + try { + $format->color = "nonExistent"; + } catch (ezcBaseValueException $e) { + return true; + } + $this->fail("Exception not thrown on set of not existing color on ezcConsoleFormat->color."); + } + + public function testSetAccessFailureStyleArray() + { + $format = new ezcConsoleOutputFormat(); + + try { + $format->style = array( "nonExistent" ); + } catch (ezcBaseValueException $e) { + return true; + } + $this->fail("Exception not thrown on set of not existing format code as array on ezcConsoleFormat->style."); + } + + public function testSetAccessFailureStyleScalar() + { + $format = new ezcConsoleOutputFormat(); + + try { + $format->style = "nonExistent"; + } catch (ezcBaseValueException $e) { + return true; + } + $this->fail("Exception not thrown on set of not existing format code as scalar on ezcConsoleFormat->style."); + } + + public function testSetAccessFailureBgcolor() + { + $format = new ezcConsoleOutputFormat(); + + try { + $format->bgcolor = "nonExistent"; + } catch (ezcBaseValueException $e) { + return true; + } + $this->fail("Exception not thrown on set of not existing color on ezcConsoleFormat->bgcolor."); + } + + public function testSetAccessFailureNonexistent() + { + $format = new ezcConsoleOutputFormat(); + + try { + $format->nonExsitent = "nonExistent"; + } catch (ezcBasePropertyNotFoundException $e) { + return true; + } + $this->fail("Exception not thrown on set of not existing color on ezcConsoleFormat->bgcolor."); + } + + public function testIssetAccessSuccess() + { + $format = new ezcConsoleOutputFormat(); + + $this->assertTrue(isset($format->color)); + $this->assertTrue(isset($format->style)); + $this->assertTrue(isset($format->bgcolor)); + } + + public function testIssetAccessFailure() + { + $format = new ezcConsoleOutputFormat(); + + $this->assertFalse(isset($format->nonExistent)); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_formats_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_formats_test.php index d0441abfcd33a231e9532c9f2b715d4ac1232827..1d3401ad0c44339d38b0e1f255aa487c1e090e88 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_formats_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_formats_test.php @@ -1,97 +1,95 @@ -default = new ezcConsoleOutputFormat(); - $this->assertEquals( - $formats, - new ezcConsoleOutputFormats(), - 'Default values incorrect for ezcConsoleOutputFormats.' - ); - } - - public function testGetAccessNonExistent() - { - $formats = new ezcConsoleOutputFormats(); - $format = new ezcConsoleOutputFormat(); - $this->assertEquals( - $format, - $formats->foobar - ); - } - - public function testGetAccessExistent() - { - $formats = new ezcConsoleOutputFormats(); - $format = new ezcConsoleOutputFormat(); - $formats->foobar = $format; - $this->assertEquals( - $format, - $formats->foobar - ); - } - - public function testGetAccessManipulate() - { - $formats = new ezcConsoleOutputFormats(); - $formats->foobar->color = 'blue'; - - $format = new ezcConsoleOutputFormat(); - $format->color = 'blue'; - - $this->assertEquals( - $format, - $formats->foobar - ); - } - - public function testSetAccessExistent() - { - $formats = new ezcConsoleOutputFormats(); - $format = new ezcConsoleOutputFormat(); - $formats->foobar = $format; - $this->assertEquals( - $format, - $formats->foobar - ); - } - - public function testIssetAccessSuccess() - { - $formats = new ezcConsoleOutputFormats(); - $formats->foobar = new ezcConsoleOutputFormat(); - $this->assertTrue( isset( $formats->foobar ) ); - } - - public function testIssetAccessFailure() - { - $formats = new ezcConsoleOutputFormats(); - $this->assertFalse( isset( $formats->foobar ) ); - } -} - -?> +default = new ezcConsoleOutputFormat(); + $this->assertEquals( + $formats, + new ezcConsoleOutputFormats(), + 'Default values incorrect for ezcConsoleOutputFormats.' + ); + } + + public function testGetAccessNonExistent() + { + $formats = new ezcConsoleOutputFormats(); + $format = new ezcConsoleOutputFormat(); + $this->assertEquals( + $format, + $formats->foobar + ); + } + + public function testGetAccessExistent() + { + $formats = new ezcConsoleOutputFormats(); + $format = new ezcConsoleOutputFormat(); + $formats->foobar = $format; + $this->assertEquals( + $format, + $formats->foobar + ); + } + + public function testGetAccessManipulate() + { + $formats = new ezcConsoleOutputFormats(); + $formats->foobar->color = 'blue'; + + $format = new ezcConsoleOutputFormat(); + $format->color = 'blue'; + + $this->assertEquals( + $format, + $formats->foobar + ); + } + + public function testSetAccessExistent() + { + $formats = new ezcConsoleOutputFormats(); + $format = new ezcConsoleOutputFormat(); + $formats->foobar = $format; + $this->assertEquals( + $format, + $formats->foobar + ); + } + + public function testIssetAccessSuccess() + { + $formats = new ezcConsoleOutputFormats(); + $formats->foobar = new ezcConsoleOutputFormat(); + $this->assertTrue(isset($formats->foobar)); + } + + public function testIssetAccessFailure() + { + $formats = new ezcConsoleOutputFormats(); + $this->assertFalse(isset($formats->foobar)); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_options_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_options_test.php index b8c11e0bba8b59bd3b942929eb50f5608f3ec6e7..af09c2f6ea3f4b0b30a5c169611b08fa3c47a8fb 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_options_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_options_test.php @@ -1,87 +1,84 @@ -assertEquals( - $fake, - new ezcConsoleOutputOptions(), - 'Default values incorrect for ezcConsoleOutputOptions.' - ); - } - - /** - * testConstructorNew - * - * @access public - */ - public function testConstructorNew() - { - $fake = new ezcConsoleOutputOptions( - array( - "verbosityLevel" => 1, - "autobreak" => 0, - "useFormats" => true, - ) - ); - $this->assertEquals( - $fake, - new ezcConsoleOutputOptions(), - 'Default values incorrect for ezcConsoleOutputOptions.' - ); - } - - public function testCompatibility() - { - $old = new ezcConsoleOutputOptions( 5, 80 ); - $new = new ezcConsoleOutputOptions( - array( - "verbosityLevel" => 5, - "autobreak" => 80, - ) - ); - $this->assertEquals( $old, $new, "Old construction method did not produce same result as old one." ); - } - - public function testNewAccess() - { - $opt = new ezcConsoleOutputOptions(); - $this->assertEquals( $opt->verbosityLevel, 1 ); - $this->assertEquals( $opt->autobreak, 0 ); - $this->assertEquals( $opt->useFormats, true ); - $this->assertEquals( $opt["verbosityLevel"], 1 ); - $this->assertEquals( $opt["autobreak"], 0 ); - $this->assertEquals( $opt["useFormats"], true ); - } - -} - -?> +assertEquals( + $fake, + new ezcConsoleOutputOptions(), + 'Default values incorrect for ezcConsoleOutputOptions.' + ); + } + + /** + * testConstructorNew + * + * @access public + */ + public function testConstructorNew() + { + $fake = new ezcConsoleOutputOptions( + array( + "verbosityLevel" => 1, + "autobreak" => 0, + "useFormats" => true, + ) + ); + $this->assertEquals( + $fake, + new ezcConsoleOutputOptions(), + 'Default values incorrect for ezcConsoleOutputOptions.' + ); + } + + public function testCompatibility() + { + $old = new ezcConsoleOutputOptions(5, 80); + $new = new ezcConsoleOutputOptions( + array( + "verbosityLevel" => 5, + "autobreak" => 80, + ) + ); + $this->assertEquals($old, $new, "Old construction method did not produce same result as old one."); + } + + public function testNewAccess() + { + $opt = new ezcConsoleOutputOptions(); + $this->assertEquals($opt->verbosityLevel, 1); + $this->assertEquals($opt->autobreak, 0); + $this->assertEquals($opt->useFormats, true); + $this->assertEquals($opt["verbosityLevel"], 1); + $this->assertEquals($opt["autobreak"], 0); + $this->assertEquals($opt["useFormats"], true); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_test.php index 5ef67574a4ce0dac79068aab18d159b2c2fc693b..dba70ab38249200465dd538905f1fb58811c0f65 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/output_test.php @@ -1,230 +1,223 @@ - array( - 'in' => array( - 'color' => 'blue', - ), - 'out' => "\033[34m%s\033[0m" - ), - 'color_only_2' => array( - 'in' => array( - 'color' => 'red', - ), - 'out' => "\033[31m%s\033[0m" - ), - 'bgcolor_only_1' => array( - 'in' => array( - 'bgcolor' => 'green', - ), - 'out' => "\033[42m%s\033[0m" - ), - 'bgcolor_only_2' => array( - 'in' => array( - 'bgcolor' => 'yellow', - ), - 'out' => "\033[43m%s\033[0m" - ), - 'style_only_1' => array( - 'in' => array( - 'style' => 'bold', - ), - 'out' => "\033[1m%s\033[0m" - ), - 'style_only_2' => array( - 'in' => array( - 'style' => 'negative', - ), - 'out' => "\033[7m%s\033[0m" - ), - ); - - private $testOptions = array( - 'set_1' => array( - 'verboseLevel' => 1, - ), - 'set_2' => array( - 'verboseLevel' => 5, - 'autobreak' => 20, - 'useFormats' => false, - ), - 'set_3' => array( - 'autobreak' => 5, - 'useFormats' => true, - 'format' => array( - 'color' => 'blue', - 'bgcolor' => 'green', - 'style' => 'negative', - ), - ), - ); - - /** - * consoleOutput - * - * @var mixed - */ - private $consoleOutput; - - public static function suite() - { - return new PHPUnit_Framework_TestSuite( "ezcConsoleToolsOutputTest" ); - } - - protected function setUp() - { - $this->consoleOutput = new ezcConsoleOutput(); - foreach ( $this->testFormats as $name => $inout ) - { - foreach ( $inout['in'] as $formatName => $val ) - { - $this->consoleOutput->formats->$name->$formatName = $val; - } - } - } - - protected function tearDown() - { - unset( $this->consoleOutput ); - } - - /** - * testFormatText - * - * @access public - */ - public function testFormatText() - { - foreach ( $this->testFormats as $name => $inout ) - { - $realRes = $this->consoleOutput->formatText( $this->testString, $name ); - $fakeRes = sprintf( $inout['out'], $this->testString ); - $this->assertEquals( - $realRes, - $fakeRes, - "Test <{$name}> failed. String <{$realRes}> (real) is not equal to <{$fakeRes}> (fake)." - ); - } - } - - /** - * testOutputText - * - * @access public - */ - public function testOutputText() - { - foreach ( $this->testFormats as $name => $inout ) - { - ob_start(); - $this->consoleOutput->outputText( $this->testString, $name ); - $realRes = ob_get_contents(); - ob_end_clean(); - $fakeRes = sprintf( $inout['out'], $this->testString ); - $this->assertEquals( - $fakeRes, - $realRes, - "Test <{$name}> failed. String <{$realRes}> (real) is not equal to <{$fakeRes}> (fake)." - ); - } - } - - /** - * testOutputTextAutobreak - * - * @access public - */ - public function testOutputTextAutobreak() - { - $this->consoleOutput->options->autobreak = 20; - $testText = 'Some text which is obviously longer than 20 characters and should be broken.'; - - $testResText = <<testFormats as $name => $inout ) - { - ob_start(); - $this->consoleOutput->outputText( $testText, $name ); - $realRes = ob_get_contents(); - ob_end_clean(); - - $fakeRes = sprintf( $inout['out'], $testResText ); - $this->assertEquals( - $fakeRes, - $realRes, - 'Test "' . $name . ' failed. String <' . $realRes . '> (real) is not equal to <' . $fakeRes . '> (fake).' - ); - } - } - - public function testOutputColorAliases() - { - $this->consoleOutput->formats->aliasBG->bgcolor = "gray"; - $this->consoleOutput->formats->aliasBG->color = "white"; - $this->consoleOutput->formats->realBG->bgcolor = "black"; - $this->consoleOutput->formats->realBG->color = "white"; - - $this->consoleOutput->formats->realFG->color = "gray"; - $this->consoleOutput->formats->realFG->bgcolor = "white"; - $this->consoleOutput->formats->aliasFG->color = "black"; - $this->consoleOutput->formats->aliasFG->bgcolor = "white"; - - $this->assertEquals( - $this->consoleOutput->formatText( "I am black!", "aliasBG" ), - $this->consoleOutput->formatText( "I am black!", "realBG" ), - "Backgroundcolor not correctly aliased to ." - ); - - $this->assertEquals( - $this->consoleOutput->formatText( "I am gray!", "aliasFG" ), - $this->consoleOutput->formatText( "I am gray!", "realFG" ), - "Foregroundcolor not correctly aliased to ." - ); - } - - /** - * dumpString - * - * @param mixed $string - */ - private function dumpString( $string ) - { - echo 'Dumping string of length ' . strlen( $string ) . ":\n\n"; - for ( $i = 0; $i < strlen( $string ); $i++ ) - { - echo "<{$string[$i]}> = -" . ord( $string[$i] ) . "-\n"; - } - echo "Finished dumping string.\n\n"; - } -} -?> + array( + 'in' => array( + 'color' => 'blue', + ), + 'out' => "\033[34m%s\033[0m" + ), + 'color_only_2' => array( + 'in' => array( + 'color' => 'red', + ), + 'out' => "\033[31m%s\033[0m" + ), + 'bgcolor_only_1' => array( + 'in' => array( + 'bgcolor' => 'green', + ), + 'out' => "\033[42m%s\033[0m" + ), + 'bgcolor_only_2' => array( + 'in' => array( + 'bgcolor' => 'yellow', + ), + 'out' => "\033[43m%s\033[0m" + ), + 'style_only_1' => array( + 'in' => array( + 'style' => 'bold', + ), + 'out' => "\033[1m%s\033[0m" + ), + 'style_only_2' => array( + 'in' => array( + 'style' => 'negative', + ), + 'out' => "\033[7m%s\033[0m" + ), + ); + + private $testOptions = array( + 'set_1' => array( + 'verboseLevel' => 1, + ), + 'set_2' => array( + 'verboseLevel' => 5, + 'autobreak' => 20, + 'useFormats' => false, + ), + 'set_3' => array( + 'autobreak' => 5, + 'useFormats' => true, + 'format' => array( + 'color' => 'blue', + 'bgcolor' => 'green', + 'style' => 'negative', + ), + ), + ); + + /** + * consoleOutput + * + * @var mixed + */ + private $consoleOutput; + + public static function suite() + { + return new PHPUnit_Framework_TestSuite("ezcConsoleToolsOutputTest"); + } + + protected function setUp() + { + $this->consoleOutput = new ezcConsoleOutput(); + foreach ($this->testFormats as $name => $inout) { + foreach ($inout['in'] as $formatName => $val) { + $this->consoleOutput->formats->$name->$formatName = $val; + } + } + } + + protected function tearDown() + { + unset($this->consoleOutput); + } + + /** + * testFormatText + * + * @access public + */ + public function testFormatText() + { + foreach ($this->testFormats as $name => $inout) { + $realRes = $this->consoleOutput->formatText($this->testString, $name); + $fakeRes = sprintf($inout['out'], $this->testString); + $this->assertEquals( + $realRes, + $fakeRes, + "Test <{$name}> failed. String <{$realRes}> (real) is not equal to <{$fakeRes}> (fake)." + ); + } + } + + /** + * testOutputText + * + * @access public + */ + public function testOutputText() + { + foreach ($this->testFormats as $name => $inout) { + ob_start(); + $this->consoleOutput->outputText($this->testString, $name); + $realRes = ob_get_contents(); + ob_end_clean(); + $fakeRes = sprintf($inout['out'], $this->testString); + $this->assertEquals( + $fakeRes, + $realRes, + "Test <{$name}> failed. String <{$realRes}> (real) is not equal to <{$fakeRes}> (fake)." + ); + } + } + + /** + * testOutputTextAutobreak + * + * @access public + */ + public function testOutputTextAutobreak() + { + $this->consoleOutput->options->autobreak = 20; + $testText = 'Some text which is obviously longer than 20 characters and should be broken.'; + + $testResText = <<testFormats as $name => $inout) { + ob_start(); + $this->consoleOutput->outputText($testText, $name); + $realRes = ob_get_contents(); + ob_end_clean(); + + $fakeRes = sprintf($inout['out'], $testResText); + $this->assertEquals( + $fakeRes, + $realRes, + 'Test "' . $name . ' failed. String <' . $realRes . '> (real) is not equal to <' . $fakeRes . '> (fake).' + ); + } + } + + public function testOutputColorAliases() + { + $this->consoleOutput->formats->aliasBG->bgcolor = "gray"; + $this->consoleOutput->formats->aliasBG->color = "white"; + $this->consoleOutput->formats->realBG->bgcolor = "black"; + $this->consoleOutput->formats->realBG->color = "white"; + + $this->consoleOutput->formats->realFG->color = "gray"; + $this->consoleOutput->formats->realFG->bgcolor = "white"; + $this->consoleOutput->formats->aliasFG->color = "black"; + $this->consoleOutput->formats->aliasFG->bgcolor = "white"; + + $this->assertEquals( + $this->consoleOutput->formatText("I am black!", "aliasBG"), + $this->consoleOutput->formatText("I am black!", "realBG"), + "Backgroundcolor not correctly aliased to ." + ); + + $this->assertEquals( + $this->consoleOutput->formatText("I am gray!", "aliasFG"), + $this->consoleOutput->formatText("I am gray!", "realFG"), + "Foregroundcolor not correctly aliased to ." + ); + } + + /** + * dumpString + * + * @param mixed $string + */ + private function dumpString($string) + { + echo 'Dumping string of length ' . strlen($string) . ":\n\n"; + for ($i = 0; $i < strlen($string); $i++) { + echo "<{$string[$i]}> = -" . ord($string[$i]) . "-\n"; + } + echo "Finished dumping string.\n\n"; + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressbar_options_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressbar_options_test.php index 2f7531b0263aa076a175876500a9d6b789c62798..ace5bf58454a15876fcf7d7a1807138271d2c849 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressbar_options_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressbar_options_test.php @@ -1,82 +1,79 @@ - "+", - "emptyChar" => "-", - "formatString" => "%act% / %max% [%bar%] %fraction%%", - "fractionFormat" => "%01.2f", - "progressChar" => ">", - "redrawFrequency" => 1, - "step" => 1, - "width" => 78, - "actFormat" => "%.0f", - "maxFormat" => "%.0f", - ) - ); - $this->assertEquals( - $fake, - new ezcConsoleProgressbarOptions(), - 'Default values incorrect for ezcConsoleProgressbarOptions.' - ); - } - - public function testNewAccess() - { - $opt = new ezcConsoleProgressbarOptions(); - $this->assertEquals( "+", $opt->barChar ); - $this->assertEquals( "-", $opt->emptyChar ); - $this->assertEquals( "%act% / %max% [%bar%] %fraction%%", $opt->formatString ); - $this->assertEquals( "%01.2f", $opt->fractionFormat ); - $this->assertEquals( ">", $opt->progressChar ); - $this->assertEquals( 1, $opt->redrawFrequency ); - $this->assertEquals( 1, $opt->step ); - $this->assertEquals( 78, $opt->width ); - $this->assertEquals( "%.0f", $opt->actFormat ); - $this->assertEquals( "%.0f", $opt->maxFormat ); - - $this->assertEquals( $opt["barChar"], "+" ); - $this->assertEquals( $opt["emptyChar"], "-" ); - $this->assertEquals( $opt["formatString"], "%act% / %max% [%bar%] %fraction%%" ); - $this->assertEquals( $opt["fractionFormat"], "%01.2f" ); - $this->assertEquals( $opt["progressChar"], ">" ); - $this->assertEquals( $opt["redrawFrequency"], 1 ); - $this->assertEquals( $opt["step"], 1 ); - $this->assertEquals( $opt["width"], 78 ); - $this->assertEquals( $opt["actFormat"], "%.0f" ); - $this->assertEquals( $opt["maxFormat"], "%.0f" ); - } - -} - -?> + "+", + "emptyChar" => "-", + "formatString" => "%act% / %max% [%bar%] %fraction%%", + "fractionFormat" => "%01.2f", + "progressChar" => ">", + "redrawFrequency" => 1, + "step" => 1, + "width" => 78, + "actFormat" => "%.0f", + "maxFormat" => "%.0f", + ) + ); + $this->assertEquals( + $fake, + new ezcConsoleProgressbarOptions(), + 'Default values incorrect for ezcConsoleProgressbarOptions.' + ); + } + + public function testNewAccess() + { + $opt = new ezcConsoleProgressbarOptions(); + $this->assertEquals("+", $opt->barChar); + $this->assertEquals("-", $opt->emptyChar); + $this->assertEquals("%act% / %max% [%bar%] %fraction%%", $opt->formatString); + $this->assertEquals("%01.2f", $opt->fractionFormat); + $this->assertEquals(">", $opt->progressChar); + $this->assertEquals(1, $opt->redrawFrequency); + $this->assertEquals(1, $opt->step); + $this->assertEquals(78, $opt->width); + $this->assertEquals("%.0f", $opt->actFormat); + $this->assertEquals("%.0f", $opt->maxFormat); + + $this->assertEquals($opt["barChar"], "+"); + $this->assertEquals($opt["emptyChar"], "-"); + $this->assertEquals($opt["formatString"], "%act% / %max% [%bar%] %fraction%%"); + $this->assertEquals($opt["fractionFormat"], "%01.2f"); + $this->assertEquals($opt["progressChar"], ">"); + $this->assertEquals($opt["redrawFrequency"], 1); + $this->assertEquals($opt["step"], 1); + $this->assertEquals($opt["width"], 78); + $this->assertEquals($opt["actFormat"], "%.0f"); + $this->assertEquals($opt["maxFormat"], "%.0f"); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressbar_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressbar_test.php index b6b0ce02738dd065d51fbd06ee2f8e6b852aac16..a01fc56c518541622592547fca82a6c61949ca81 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressbar_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressbar_test.php @@ -1,141 +1,137 @@ -commonProgressbarTest( __FUNCTION__, 42, 13, array () ); - } - - public function testProgress2() - { - $this->commonProgressbarTest( __FUNCTION__, 20, 32, array () ); - } - - public function testProgress3() - { - $this->commonProgressbarTest( __FUNCTION__, 42, 13, array ( 'barChar' => '#', 'emptyChar' => '*' ) ); - } - - public function testProgress4() - { - $this->commonProgressbarTest( __FUNCTION__, 55, 19, array ( 'progressChar' => '&' ) ); - } - - public function testProgress5() - { - $this->commonProgressbarTest( __FUNCTION__, 42, 13, array ( 'progressChar' => '&', 'width' => 55 ) ); - } - - public function testProgress6() - { - $this->commonProgressbarTest( __FUNCTION__, 22, 3, array ( 'barChar' => '#', 'emptyChar' => '*', 'progressChar' => '&', 'width' => 81 ) ); - } - - public function testProgress7() - { - $this->commonProgressbarTest( __FUNCTION__, 42, 7, array ( 'barChar' => '1234', 'emptyChar' => '9876' ) ); - } - - public function testProgress8() - { - $this->commonProgressbarTest( __FUNCTION__, 42, 7, array ( 'barChar' => '123', 'emptyChar' => '987', 'progressChar' => '---' ) ); - } - - public function testProgress9() - { - $out = new ezcConsoleOutput(); - - $formatString = '' - . $out->formatText( 'Actual progress', 'success' ) - . ': <' - . $out->formatText( '%bar%', 'failure' ) - . '> ' - . $out->formatText( '%fraction%', 'success' ); - - $this->commonProgressbarTest( - __FUNCTION__, - 1073, - 123, - array( - 'barChar' => '123', - 'emptyChar' => '987', - 'progressChar' => '---', - 'width' => 97, - 'formatString' => $formatString, - 'fractionFormat' => '%o' - ) - ); - } - - public function testProgress10() - { - $this->commonProgressbarTest( __FUNCTION__, 100, 1, array ( 'redrawFrequency' => 10 ) ); - } - - public function testProgress11() - { - $this->commonProgressbarTest( __FUNCTION__, 100, 2.5, array ( 'actFormat' => '%01.2f', 'maxFormat' => '%01.2f' ) ); - } - - public function testProgress12() - { - $this->commonProgressbarTest( __FUNCTION__, 100, 2.5, array ( 'actFormat' => '%01.2f', 'maxFormat' => '%01.8f' ) ); - } - - public function testProgress13() - { - $this->commonProgressbarTest( __FUNCTION__, 100, 2.5, array ( 'actFormat' => '%01.8f', 'maxFormat' => '%01.2f' ) ); - } - - private function commonProgressbarTest( $refFile, $max, $step, $options ) - { - $out = new ezcConsoleOutput(); - $bar = new ezcConsoleProgressbar( $out, $max, $options ); - if ( $step != 1 ) - { - $bar->options->step = $step; - } - $res = array(); - for ( $i = 0; $i < $max; $i+= $step) - { - ob_start(); - $bar->advance(); - // sleep(1); - $resTmp = ob_get_contents(); - if (trim($resTmp) !== '') - { - $res[] = $resTmp; - } - ob_end_clean(); - } - $this->assertEquals( - file_get_contents( dirname( __FILE__ ) . '/data/' . $refFile . '.dat' ), - implode( "\n", $res ), - 'Table not correctly generated for ' . $refFile . '.' - ); - // Use the following line to regenerate test reference files - // file_put_contents( dirname( __FILE__ ) . '/data/' . $refFile . '.dat', implode( "\n", $res ) ); - } -} -?> +commonProgressbarTest(__FUNCTION__, 42, 13, array ()); + } + + public function testProgress2() + { + $this->commonProgressbarTest(__FUNCTION__, 20, 32, array ()); + } + + public function testProgress3() + { + $this->commonProgressbarTest(__FUNCTION__, 42, 13, array ( 'barChar' => '#', 'emptyChar' => '*' )); + } + + public function testProgress4() + { + $this->commonProgressbarTest(__FUNCTION__, 55, 19, array ( 'progressChar' => '&' )); + } + + public function testProgress5() + { + $this->commonProgressbarTest(__FUNCTION__, 42, 13, array ( 'progressChar' => '&', 'width' => 55 )); + } + + public function testProgress6() + { + $this->commonProgressbarTest(__FUNCTION__, 22, 3, array ( 'barChar' => '#', 'emptyChar' => '*', 'progressChar' => '&', 'width' => 81 )); + } + + public function testProgress7() + { + $this->commonProgressbarTest(__FUNCTION__, 42, 7, array ( 'barChar' => '1234', 'emptyChar' => '9876' )); + } + + public function testProgress8() + { + $this->commonProgressbarTest(__FUNCTION__, 42, 7, array ( 'barChar' => '123', 'emptyChar' => '987', 'progressChar' => '---' )); + } + + public function testProgress9() + { + $out = new ezcConsoleOutput(); + + $formatString = '' + . $out->formatText('Actual progress', 'success') + . ': <' + . $out->formatText('%bar%', 'failure') + . '> ' + . $out->formatText('%fraction%', 'success'); + + $this->commonProgressbarTest( + __FUNCTION__, + 1073, + 123, + array( + 'barChar' => '123', + 'emptyChar' => '987', + 'progressChar' => '---', + 'width' => 97, + 'formatString' => $formatString, + 'fractionFormat' => '%o' + ) + ); + } + + public function testProgress10() + { + $this->commonProgressbarTest(__FUNCTION__, 100, 1, array ( 'redrawFrequency' => 10 )); + } + + public function testProgress11() + { + $this->commonProgressbarTest(__FUNCTION__, 100, 2.5, array ( 'actFormat' => '%01.2f', 'maxFormat' => '%01.2f' )); + } + + public function testProgress12() + { + $this->commonProgressbarTest(__FUNCTION__, 100, 2.5, array ( 'actFormat' => '%01.2f', 'maxFormat' => '%01.8f' )); + } + + public function testProgress13() + { + $this->commonProgressbarTest(__FUNCTION__, 100, 2.5, array ( 'actFormat' => '%01.8f', 'maxFormat' => '%01.2f' )); + } + + private function commonProgressbarTest($refFile, $max, $step, $options) + { + $out = new ezcConsoleOutput(); + $bar = new ezcConsoleProgressbar($out, $max, $options); + if ($step != 1) { + $bar->options->step = $step; + } + $res = array(); + for ($i = 0; $i < $max; $i+= $step) { + ob_start(); + $bar->advance(); + // sleep(1); + $resTmp = ob_get_contents(); + if (trim($resTmp) !== '') { + $res[] = $resTmp; + } + ob_end_clean(); + } + $this->assertEquals( + file_get_contents(dirname(__FILE__) . '/data/' . $refFile . '.dat'), + implode("\n", $res), + 'Table not correctly generated for ' . $refFile . '.' + ); + // Use the following line to regenerate test reference files + // file_put_contents( dirname( __FILE__ ) . '/data/' . $refFile . '.dat', implode( "\n", $res ) ); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressmonitor_options_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressmonitor_options_test.php index f57c836fb8224fc3cea37c09542c3c9d399cc29c..e7fc879142315700aa69641df6e9a936a10ec33c 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressmonitor_options_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressmonitor_options_test.php @@ -1,55 +1,52 @@ - "%8.1f%% %s %s", - ) - ); - $this->assertEquals( - $fake, - new ezcConsoleProgressMonitorOptions(), - 'Default values incorrect for ezcConsoleProgressMonitorOptions.' - ); - } - - public function testNewAccess() - { - $opt = new ezcConsoleProgressMonitorOptions(); - $this->assertEquals( "%8.1f%% %s %s", $opt->formatString ); - - $this->assertEquals( $opt["formatString"], "%8.1f%% %s %s" ); - } - -} - -?> + "%8.1f%% %s %s", + ) + ); + $this->assertEquals( + $fake, + new ezcConsoleProgressMonitorOptions(), + 'Default values incorrect for ezcConsoleProgressMonitorOptions.' + ); + } + + public function testNewAccess() + { + $opt = new ezcConsoleProgressMonitorOptions(); + $this->assertEquals("%8.1f%% %s %s", $opt->formatString); + + $this->assertEquals($opt["formatString"], "%8.1f%% %s %s"); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressmonitor_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressmonitor_test.php index 9ac551150246056b9a6186586f0f59172d925c87..8130de3a3e6a363a950f1adda9c5624253b6d9a9 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressmonitor_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/progressmonitor_test.php @@ -1,125 +1,123 @@ -addEntry( $this->stati[$i][0], $this->stati[$i][1] ); - } - $res = ob_get_contents(); - ob_end_clean(); - $this->assertEquals( - file_get_contents( dirname( __FILE__ ) . '/data/testProgressMonitor1.dat' ), - $res, - "Formated statusbar not generated correctly." - ); - // To prepare test files use this: - //file_put_contents( dirname( __FILE__ ) . '/data/testProgressMonitor1.dat', $res ); - } - - public function testProgressMonitor2() - { - $out = new ezcConsoleOutput(); - $status = new ezcConsoleProgressMonitor( $out, 7 ); - ob_start(); - for ( $i = 0; $i < 7; $i++ ) - { - $status->addEntry( $this->stati[$i][0], $this->stati[$i][1] ); - } - $res = ob_get_contents(); - ob_end_clean(); - $this->assertEquals( - file_get_contents( dirname( __FILE__ ) . '/data/testProgressMonitor2.dat' ), - $res, - "Formated statusbar not generated correctly." - ); - // To prepare test files use this: - // file_put_contents( dirname( __FILE__ ) . '/data/testProgressMonitor2.dat', $res ); - } - - public function testProgressMonitor3() - { - $out = new ezcConsoleOutput(); - $status = new ezcConsoleProgressMonitor( $out, 7, array( 'formatString' => '%2$10s %1$6.2f%% %3$s' ) ); - ob_start(); - for ( $i = 0; $i < 7; $i++ ) - { - $status->addEntry( $this->stati[$i][0], $this->stati[$i][1] ); - } - $res = ob_get_contents(); - ob_end_clean(); - $this->assertEquals( - file_get_contents( dirname( __FILE__ ) . '/data/testProgressMonitor3.dat' ), - $res, - "Formated statusbar not generated correctly." - ); - // To prepare test files use this: - // file_put_contents( dirname( __FILE__ ) . '/data/testProgressMonitor3.dat', $res ); - } - - public function testProgressMonitor4() - { - $out = new ezcConsoleOutput(); - $out->formats->tag->color = 'red'; - $out->formats->percent->color = 'blue'; - $out->formats->percent->style = array( 'bold' ); - $out->formats->data->color = 'green'; - - $status = new ezcConsoleProgressMonitor( $out, 7, - array( 'formatString' => - $out->formatText( '%2$10s', 'tag' ) . ' ' . $out->formatText( '%1$6.2f%%', 'percent' ) . ' ' . $out->formatText( '%3$s', 'data' ) ) ); - ob_start(); - for ( $i = 0; $i < 7; $i++ ) - { - $status->addEntry( $this->stati[$i][0], $this->stati[$i][1] ); - } - $res = ob_get_contents(); - ob_end_clean(); - $this->assertEquals( - file_get_contents( dirname( __FILE__ ) . '/data/testProgressMonitor4.dat' ), - $res, - "Formated statusbar not generated correctly." - ); - // To prepare test files use this: - // file_put_contents( dirname( __FILE__ ) . '/data/testProgressMonitor4.dat', $res ); - } -} -?> +addEntry($this->stati[$i][0], $this->stati[$i][1]); + } + $res = ob_get_contents(); + ob_end_clean(); + $this->assertEquals( + file_get_contents(dirname(__FILE__) . '/data/testProgressMonitor1.dat'), + $res, + "Formated statusbar not generated correctly." + ); + // To prepare test files use this: + //file_put_contents( dirname( __FILE__ ) . '/data/testProgressMonitor1.dat', $res ); + } + + public function testProgressMonitor2() + { + $out = new ezcConsoleOutput(); + $status = new ezcConsoleProgressMonitor($out, 7); + ob_start(); + for ($i = 0; $i < 7; $i++) { + $status->addEntry($this->stati[$i][0], $this->stati[$i][1]); + } + $res = ob_get_contents(); + ob_end_clean(); + $this->assertEquals( + file_get_contents(dirname(__FILE__) . '/data/testProgressMonitor2.dat'), + $res, + "Formated statusbar not generated correctly." + ); + // To prepare test files use this: + // file_put_contents( dirname( __FILE__ ) . '/data/testProgressMonitor2.dat', $res ); + } + + public function testProgressMonitor3() + { + $out = new ezcConsoleOutput(); + $status = new ezcConsoleProgressMonitor($out, 7, array( 'formatString' => '%2$10s %1$6.2f%% %3$s' )); + ob_start(); + for ($i = 0; $i < 7; $i++) { + $status->addEntry($this->stati[$i][0], $this->stati[$i][1]); + } + $res = ob_get_contents(); + ob_end_clean(); + $this->assertEquals( + file_get_contents(dirname(__FILE__) . '/data/testProgressMonitor3.dat'), + $res, + "Formated statusbar not generated correctly." + ); + // To prepare test files use this: + // file_put_contents( dirname( __FILE__ ) . '/data/testProgressMonitor3.dat', $res ); + } + + public function testProgressMonitor4() + { + $out = new ezcConsoleOutput(); + $out->formats->tag->color = 'red'; + $out->formats->percent->color = 'blue'; + $out->formats->percent->style = array( 'bold' ); + $out->formats->data->color = 'green'; + + $status = new ezcConsoleProgressMonitor( + $out, + 7, + array( 'formatString' => + $out->formatText('%2$10s', 'tag') . ' ' . $out->formatText('%1$6.2f%%', 'percent') . ' ' . $out->formatText('%3$s', 'data') ) + ); + ob_start(); + for ($i = 0; $i < 7; $i++) { + $status->addEntry($this->stati[$i][0], $this->stati[$i][1]); + } + $res = ob_get_contents(); + ob_end_clean(); + $this->assertEquals( + file_get_contents(dirname(__FILE__) . '/data/testProgressMonitor4.dat'), + $res, + "Formated statusbar not generated correctly." + ); + // To prepare test files use this: + // file_put_contents( dirname( __FILE__ ) . '/data/testProgressMonitor4.dat', $res ); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/statusbar_options_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/statusbar_options_test.php index 1756e7bf1bb86f2ba1b5cbe84c675aafee5f445c..0fe53e77193d7b5b18733cc3ec62ef7ee38dd6ce 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/statusbar_options_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/statusbar_options_test.php @@ -1,58 +1,55 @@ - "+", - "failureChar" => "-", - ) - ); - $this->assertEquals( - $fake, - new ezcConsoleStatusbarOptions(), - 'Default values incorrect for ezcConsoleStatusbarOptions.' - ); - } - - public function testNewAccess() - { - $opt = new ezcConsoleStatusbarOptions(); - $this->assertEquals( "+", $opt->successChar ); - $this->assertEquals( "-", $opt->failureChar ); - - $this->assertEquals( $opt["successChar"], "+" ); - $this->assertEquals( $opt["failureChar"], "-" ); - } - -} - -?> + "+", + "failureChar" => "-", + ) + ); + $this->assertEquals( + $fake, + new ezcConsoleStatusbarOptions(), + 'Default values incorrect for ezcConsoleStatusbarOptions.' + ); + } + + public function testNewAccess() + { + $opt = new ezcConsoleStatusbarOptions(); + $this->assertEquals("+", $opt->successChar); + $this->assertEquals("-", $opt->failureChar); + + $this->assertEquals($opt["successChar"], "+"); + $this->assertEquals($opt["failureChar"], "-"); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/statusbar_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/statusbar_test.php index b3fc984f90fbcee8326e6bd989e63c1a97881872..d0270cad2ce50b990c382491f9719786d77d698c 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/statusbar_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/statusbar_test.php @@ -1,94 +1,91 @@ -stati as $statusVal ) - { - $status->add($statusVal); - } - $res = ob_get_contents(); - ob_end_clean(); - $this->assertEquals( - file_get_contents( dirname( __FILE__ ) . '/data/testStatusbar1.dat' ), - $res, - "Formated statusbar not generated correctly." - ); - // To prepare test files use this: - // file_put_contents( dirname( __FILE__ ) . '/data/testStatusbar1.dat', $res ); - } - - public function testStatusbar2() - { - $out = new ezcConsoleOutput(); - $out->options->useFormats = false; - $status = new ezcConsoleStatusbar( $out ); - ob_start(); - foreach ( $this->stati as $statusVal ) - { - $status->add($statusVal); - } - $res = ob_get_contents(); - ob_end_clean(); - $this->assertEquals( - file_get_contents( dirname( __FILE__ ) . '/data/testStatusbar2.dat' ), - $res, - "Unformated statusbar not generated correctly." - ); - // To prepare test files use this: - // file_put_contents( dirname( __FILE__ ) . '/data/testStatusbar2.dat', $res ); - } -} -?> +stati as $statusVal) { + $status->add($statusVal); + } + $res = ob_get_contents(); + ob_end_clean(); + $this->assertEquals( + file_get_contents(dirname(__FILE__) . '/data/testStatusbar1.dat'), + $res, + "Formated statusbar not generated correctly." + ); + // To prepare test files use this: + // file_put_contents( dirname( __FILE__ ) . '/data/testStatusbar1.dat', $res ); + } + + public function testStatusbar2() + { + $out = new ezcConsoleOutput(); + $out->options->useFormats = false; + $status = new ezcConsoleStatusbar($out); + ob_start(); + foreach ($this->stati as $statusVal) { + $status->add($statusVal); + } + $res = ob_get_contents(); + ob_end_clean(); + $this->assertEquals( + file_get_contents(dirname(__FILE__) . '/data/testStatusbar2.dat'), + $res, + "Unformated statusbar not generated correctly." + ); + // To prepare test files use this: + // file_put_contents( dirname( __FILE__ ) . '/data/testStatusbar2.dat', $res ); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/suite.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/suite.php index fd717e9249c19d464337c6963c18c803c10b9c26..05efb7eedffd650a3fa8612cff76910837434d78 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/suite.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/suite.php @@ -1,118 +1,117 @@ -setName( "ConsoleTools" ); - - $this->addTest( ezcConsoleToolsOutputTest::suite() ); - $this->addTest( ezcConsoleToolsOutputFormatTest::suite() ); - $this->addTest( ezcConsoleToolsOutputFormatsTest::suite() ); - $this->addTest( ezcConsoleToolsOutputOptionsTest::suite() ); - $this->addTest( ezcConsoleToolsInputTest::suite() ); - $this->addTest( ezcConsoleToolsOptionTest::suite() ); - $this->addTest( ezcConsoleToolsOptionRuleTest::suite() ); - $this->addTest( ezcConsoleToolsTableCellTest::suite() ); - $this->addTest( ezcConsoleToolsTableRowTest::suite() ); - $this->addTest( ezcConsoleToolsTableTest::suite() ); - $this->addTest( ezcConsoleToolsTableOptionsTest::suite() ); - $this->addTest( ezcConsoleToolsProgressbarTest::suite() ); - $this->addTest( ezcConsoleToolsProgressbarOptionsTest::suite() ); - $this->addTest( ezcConsoleToolsStatusbarTest::suite() ); - $this->addTest( ezcConsoleToolsStatusbarOptionsTest::suite() ); - $this->addTest( ezcConsoleToolsProgressMonitorTest::suite() ); - $this->addTest( ezcConsoleToolsProgressMonitorOptionsTest::suite() ); - } - - public static function suite() - { - return new ezcConsoleToolsSuite( "ezcConsoleToolsSuite" ); - } -} -?> +setName("ConsoleTools"); + + $this->addTest(ezcConsoleToolsOutputTest::suite()); + $this->addTest(ezcConsoleToolsOutputFormatTest::suite()); + $this->addTest(ezcConsoleToolsOutputFormatsTest::suite()); + $this->addTest(ezcConsoleToolsOutputOptionsTest::suite()); + $this->addTest(ezcConsoleToolsInputTest::suite()); + $this->addTest(ezcConsoleToolsOptionTest::suite()); + $this->addTest(ezcConsoleToolsOptionRuleTest::suite()); + $this->addTest(ezcConsoleToolsTableCellTest::suite()); + $this->addTest(ezcConsoleToolsTableRowTest::suite()); + $this->addTest(ezcConsoleToolsTableTest::suite()); + $this->addTest(ezcConsoleToolsTableOptionsTest::suite()); + $this->addTest(ezcConsoleToolsProgressbarTest::suite()); + $this->addTest(ezcConsoleToolsProgressbarOptionsTest::suite()); + $this->addTest(ezcConsoleToolsStatusbarTest::suite()); + $this->addTest(ezcConsoleToolsStatusbarOptionsTest::suite()); + $this->addTest(ezcConsoleToolsProgressMonitorTest::suite()); + $this->addTest(ezcConsoleToolsProgressMonitorOptionsTest::suite()); + } + + public static function suite() + { + return new ezcConsoleToolsSuite("ezcConsoleToolsSuite"); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_cell_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_cell_test.php index 3079598cfdccb6f404f3e88eeca8eb754ab5277b..1b9ff04f144ab6f86daced1a754bc1100c9ec03c 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_cell_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_cell_test.php @@ -1,50 +1,45 @@ -assertTrue( - isset( $cell->content ) && $cell->content === 'test' && isset( $cell->format ) && $cell->format === 'success' && isset( $cell->align ) && $cell->align === ezcConsoleTable::ALIGN_RIGHT, - "ezcConsoleTableCell not correctly created." - ); - } - - public function testCtorFailure() - { - try - { - $cell = new ezcConsoleTableCell( 'test', 'success', 42 ); - } - catch ( ezcBaseValueException $e ) - { - $this->assertTrue(true); - return; - } - $this->fail( "Exception not thrown on invalid align value." ); - } - -} -?> +assertTrue( + isset($cell->content) && $cell->content === 'test' && isset($cell->format) && $cell->format === 'success' && isset($cell->align) && $cell->align === ezcConsoleTable::ALIGN_RIGHT, + "ezcConsoleTableCell not correctly created." + ); + } + + public function testCtorFailure() + { + try { + $cell = new ezcConsoleTableCell('test', 'success', 42); + } catch (ezcBaseValueException $e) { + $this->assertTrue(true); + return; + } + $this->fail("Exception not thrown on invalid align value."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_options_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_options_test.php index ce855057bfb60e8fa12b0743da129341fa2a1156..acb5baffde7437085bbb70211a89ea78ae8e0b7c 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_options_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_options_test.php @@ -1,175 +1,172 @@ -assertEquals( - $fake, - new ezcConsoleTableOptions(), - 'Default values incorrect for ezcConsoleTableOptions.' - ); - } - - /** - * testConstructorNew - * - * @access public - */ - public function testConstructorNew() - { - $fake = new ezcConsoleTableOptions( - array( - "colWidth" => "auto", - "colWrap" => ezcConsoleTable::WRAP_AUTO, - "defaultAlign" => ezcConsoleTable::ALIGN_LEFT, - "colPadding" => " ", - "widthType" => ezcConsoleTable::WIDTH_MAX, - "lineVertical" => "-", - "lineHorizontal" => "|", - "corner" => "+", - "defaultFormat" => "default", - "defaultBorderFormat" => "default" - ) - ); - $this->assertEquals( - $fake, - new ezcConsoleTableOptions(), - 'Default values incorrect for ezcConsoleTableOptions.' - ); - } - - public function testCompatibility() - { - $old = new ezcConsoleTableOptions( - array( 10, 20, 10 ), - ezcConsoleTable::WRAP_CUT, - ezcConsoleTable::ALIGN_CENTER, - "-", - ezcConsoleTable::WIDTH_FIXED, - "_", - "I", - "x", - "red", - "blue" - ); - $new = new ezcConsoleTableOptions( - array( - "colWidth" => array( 10, 20, 10 ), - "colWrap" => ezcConsoleTable::WRAP_CUT, - "defaultAlign" => ezcConsoleTable::ALIGN_CENTER, - "colPadding" => "-", - "widthType" => ezcConsoleTable::WIDTH_FIXED, - "lineVertical" => "_", - "lineHorizontal" => "I", - "corner" => "x", - "defaultFormat" => "red", - "defaultBorderFormat" => "blue" - ) - ); - $this->assertEquals( $old, $new, "Old construction method did not produce same result as old one." ); - } - - public function testAccess() - { - $opt = new ezcConsoleTableOptions(); - - $this->assertEquals( $opt->colWidth, "auto" ); - $this->assertEquals( $opt->colWrap, ezcConsoleTable::WRAP_AUTO ); - $this->assertEquals( $opt->defaultAlign, ezcConsoleTable::ALIGN_LEFT ); - $this->assertEquals( $opt->colPadding, " " ); - $this->assertEquals( $opt->widthType, ezcConsoleTable::WIDTH_MAX ); - $this->assertEquals( $opt->lineVertical, "-" ); - $this->assertEquals( $opt->lineHorizontal, "|" ); - $this->assertEquals( $opt->corner, "+" ); - $this->assertEquals( $opt->defaultFormat, "default" ); - $this->assertEquals( $opt->defaultBorderFormat, "default" ); - - $this->assertEquals( $opt["colWidth"], "auto" ); - $this->assertEquals( $opt["colWrap"], ezcConsoleTable::WRAP_AUTO ); - $this->assertEquals( $opt["defaultAlign"], ezcConsoleTable::ALIGN_LEFT ); - $this->assertEquals( $opt["colPadding"], " " ); - $this->assertEquals( $opt["widthType"], ezcConsoleTable::WIDTH_MAX ); - $this->assertEquals( $opt["lineVertical"], "-" ); - $this->assertEquals( $opt["lineHorizontal"], "|" ); - $this->assertEquals( $opt["corner"], "+" ); - $this->assertEquals( $opt["defaultFormat"], "default" ); - $this->assertEquals( $opt["defaultBorderFormat"], "default" ); - } - - public function testConstructorFirstParameter() - { - $colWidthArray = new ezcConsoleTableOptions( - array( 1, 2, 3 ) - ); - - $optionsArray = new ezcConsoleTableOptions( - array( - "colWidth" => array( 1, 2, 3 ), - ) - ); - - $this->assertEquals( $colWidthArray, $optionsArray, "Did not detect options array correctly." ); - } - - public function testTableConstructorCompatibility() - { - $out = new ezcConsoleOutput(); - $old = new ezcConsoleTable( - $out, - 100, - new ezcConsoleTableOptions( - array( 1, 2, 3 ) - ) - ); - $new = new ezcConsoleTable( - $out, - 100, - array( - "colWidth" => array( 1, 2, 3 ), - ) - ); - $this->assertEquals( $old, $new, "Constructor calls did not produce same table objects." ); - } - -} - -?> +assertEquals( + $fake, + new ezcConsoleTableOptions(), + 'Default values incorrect for ezcConsoleTableOptions.' + ); + } + + /** + * testConstructorNew + * + * @access public + */ + public function testConstructorNew() + { + $fake = new ezcConsoleTableOptions( + array( + "colWidth" => "auto", + "colWrap" => ezcConsoleTable::WRAP_AUTO, + "defaultAlign" => ezcConsoleTable::ALIGN_LEFT, + "colPadding" => " ", + "widthType" => ezcConsoleTable::WIDTH_MAX, + "lineVertical" => "-", + "lineHorizontal" => "|", + "corner" => "+", + "defaultFormat" => "default", + "defaultBorderFormat" => "default" + ) + ); + $this->assertEquals( + $fake, + new ezcConsoleTableOptions(), + 'Default values incorrect for ezcConsoleTableOptions.' + ); + } + + public function testCompatibility() + { + $old = new ezcConsoleTableOptions( + array( 10, 20, 10 ), + ezcConsoleTable::WRAP_CUT, + ezcConsoleTable::ALIGN_CENTER, + "-", + ezcConsoleTable::WIDTH_FIXED, + "_", + "I", + "x", + "red", + "blue" + ); + $new = new ezcConsoleTableOptions( + array( + "colWidth" => array( 10, 20, 10 ), + "colWrap" => ezcConsoleTable::WRAP_CUT, + "defaultAlign" => ezcConsoleTable::ALIGN_CENTER, + "colPadding" => "-", + "widthType" => ezcConsoleTable::WIDTH_FIXED, + "lineVertical" => "_", + "lineHorizontal" => "I", + "corner" => "x", + "defaultFormat" => "red", + "defaultBorderFormat" => "blue" + ) + ); + $this->assertEquals($old, $new, "Old construction method did not produce same result as old one."); + } + + public function testAccess() + { + $opt = new ezcConsoleTableOptions(); + + $this->assertEquals($opt->colWidth, "auto"); + $this->assertEquals($opt->colWrap, ezcConsoleTable::WRAP_AUTO); + $this->assertEquals($opt->defaultAlign, ezcConsoleTable::ALIGN_LEFT); + $this->assertEquals($opt->colPadding, " "); + $this->assertEquals($opt->widthType, ezcConsoleTable::WIDTH_MAX); + $this->assertEquals($opt->lineVertical, "-"); + $this->assertEquals($opt->lineHorizontal, "|"); + $this->assertEquals($opt->corner, "+"); + $this->assertEquals($opt->defaultFormat, "default"); + $this->assertEquals($opt->defaultBorderFormat, "default"); + + $this->assertEquals($opt["colWidth"], "auto"); + $this->assertEquals($opt["colWrap"], ezcConsoleTable::WRAP_AUTO); + $this->assertEquals($opt["defaultAlign"], ezcConsoleTable::ALIGN_LEFT); + $this->assertEquals($opt["colPadding"], " "); + $this->assertEquals($opt["widthType"], ezcConsoleTable::WIDTH_MAX); + $this->assertEquals($opt["lineVertical"], "-"); + $this->assertEquals($opt["lineHorizontal"], "|"); + $this->assertEquals($opt["corner"], "+"); + $this->assertEquals($opt["defaultFormat"], "default"); + $this->assertEquals($opt["defaultBorderFormat"], "default"); + } + + public function testConstructorFirstParameter() + { + $colWidthArray = new ezcConsoleTableOptions( + array( 1, 2, 3 ) + ); + + $optionsArray = new ezcConsoleTableOptions( + array( + "colWidth" => array( 1, 2, 3 ), + ) + ); + + $this->assertEquals($colWidthArray, $optionsArray, "Did not detect options array correctly."); + } + + public function testTableConstructorCompatibility() + { + $out = new ezcConsoleOutput(); + $old = new ezcConsoleTable( + $out, + 100, + new ezcConsoleTableOptions( + array( 1, 2, 3 ) + ) + ); + $new = new ezcConsoleTable( + $out, + 100, + array( + "colWidth" => array( 1, 2, 3 ), + ) + ); + $this->assertEquals($old, $new, "Constructor calls did not produce same table objects."); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_row_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_row_test.php index f58aae7c4b7cd46eb00d2d000c0d50ff618af0ed..7246e85faac8de7ca5ff4bfef83f77c5447e22be 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_row_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_row_test.php @@ -1,244 +1,237 @@ -assertEquals( - 2, - count( $row ), - "ezcConsoleTableRow not correctly created." - ); - } - - public function testCtorSuccess_2() - { - $row = new ezcConsoleTableRow(); - $this->assertEquals( - 0, - count( $row ), - "ezcConsoleTableRow not correctly created." - ); - } - - public function testCtorFailure() - { - /* - * // Unneccessary, typehint! - * - $row = new ezcConsoleTableRow( 'foo' ); - $this->assertEquals( - 0, - count( $row ), - "ezcConsoleTableRow not correctly created." - ); - */ - } - - public function testAppend() - { - $row = new ezcConsoleTableRow(); - $row[]->content = 'foo'; - $this->assertTrue( - $row[0] instanceof ezcConsoleTableCell, - "ezcConsoleTableCell not correctly created on write access." - ); - } - - public function testOntheflyCreationRead_1() - { - $row = new ezcConsoleTableRow(); - $this->assertTrue( - $row[0] instanceof ezcConsoleTableCell, - "ezcConsoleTableCell not correctly created on write access." - ); - } - - public function testOntheflyCreationRead_2() - { - $row = new ezcConsoleTableRow(); - $row[0]; $row[1]; $row[2]; - $this->assertTrue( - count( $row ) == 3, - "ezcConsoleTableCell not correctly created on write access." - ); - } - - public function testOntheflyCreationRead_3() - { - $row = new ezcConsoleTableRow(); - $row[0]->content = 'test'; - $row[1]->format = 'test'; - $row[2]->align = ezcConsoleTable::ALIGN_CENTER; - $this->assertTrue( - count($row) == 3, - "ezcConsoleTableCell not correctly created on write access." - ); - } - - public function testOntheflyCreationWrite_1() - { - $row = new ezcConsoleTableRow(); - $row[0] = new ezcConsoleTableCell(); - $row[0]->content = 'test'; - $this->assertTrue( - count($row) == 1 && $row[0] instanceof ezcConsoleTableCell && $row[0]->content === 'test', - "ezcConsoleTableCell not correctly created on write access." - ); - } - - public function testNoOntheflyCreationIsset() - { - $row = new ezcConsoleTableRow(); - $this->assertEquals( - isset( $row[0] ), - false, - "ezcConsoleTableCell created on isset access." - ); - $this->assertEquals( - count($row), - 0, - "ezcConsoleTableCell created on isset access." - ); - } - - public function testForeach_1() - { - $row = new ezcConsoleTableRow(); - for ( $i = 0; $i < 10; $i++ ) - { - $row[$i]->content = 'Is '.$i; - } - $this->assertEquals( - count( $row ), - 10, - "ezcConsoleTableCells not correctly created on write access." - ); - foreach ( $row as $id => $cell ) - { - $this->assertEquals( - 'Is ' . $id, - $cell->content, - "Cell with wrong content found on iteration." - ); - } - } - - public function testForeach_2() - { - $row = new ezcConsoleTableRow(); - for ( $i = 0; $i < 20; $i += 2 ) - { - $row[$i]->content = 'Is '.$i; - } - $this->assertEquals( - count( $row ), - 19, - "ezcConsoleTableCells." - ); - foreach ( $row as $id => $cell ); - { - $this->assertEquals( - 'Is ' . $id, - $cell->content, - "Cell with wrong content found on iteration." - ); - } - } - - public function testCount_1() - { - $row = new ezcConsoleTableRow(); - $row[0]->content = 0; - $this->assertEquals( - 1, - count( $row ), - "Did not count number of cells correctly" - ); - } - - public function testCount_2() - { - $row = new ezcConsoleTableRow(); - $row[1]->content = 0; - $this->assertEquals( - 2, - count( $row ), - "Did not count number of cells correctly" - ); - } - - public function testCount_3() - { - $row = new ezcConsoleTableRow(); - $row[10]->content = 0; - $this->assertEquals( - 11, - count( $row ), - "Did not count number of cells correctly" - ); - } - - public function testSetAllCellsProperties_1() - { - $row = new ezcConsoleTableRow(); - for ( $i = 0; $i < 10; $i++ ) - { - $row[$i]->content = $i; - } - - $row->align = ezcConsoleTable::ALIGN_CENTER; - - foreach ( $this as $cell ) - { - $this->assertEquals( - ezcConsoleTable::ALIGN_CENTER, - $cell->align, - "Did not set alignment correctly for all contained cells." - ); - } - } - - public function testSetAllCellsProperties_2() - { - $row = new ezcConsoleTableRow(); - for ( $i = 0; $i < 10; $i++ ) - { - $row[$i]->content = $i; - } - - $row->format = 'headline'; - - foreach ( $this as $cell ) - { - $this->assertEquals( - 'headline', - $cell->format, - "Did not set alignment correctly for all contained cells." - ); - } - } - -} -?> +assertEquals( + 2, + count($row), + "ezcConsoleTableRow not correctly created." + ); + } + + public function testCtorSuccess_2() + { + $row = new ezcConsoleTableRow(); + $this->assertEquals( + 0, + count($row), + "ezcConsoleTableRow not correctly created." + ); + } + + public function testCtorFailure() + { + /* + * // Unneccessary, typehint! + * + $row = new ezcConsoleTableRow( 'foo' ); + $this->assertEquals( + 0, + count( $row ), + "ezcConsoleTableRow not correctly created." + ); + */ + } + + public function testAppend() + { + $row = new ezcConsoleTableRow(); + $row[]->content = 'foo'; + $this->assertTrue( + $row[0] instanceof ezcConsoleTableCell, + "ezcConsoleTableCell not correctly created on write access." + ); + } + + public function testOntheflyCreationRead_1() + { + $row = new ezcConsoleTableRow(); + $this->assertTrue( + $row[0] instanceof ezcConsoleTableCell, + "ezcConsoleTableCell not correctly created on write access." + ); + } + + public function testOntheflyCreationRead_2() + { + $row = new ezcConsoleTableRow(); + $row[0]; + $row[1]; + $row[2]; + $this->assertTrue( + count($row) == 3, + "ezcConsoleTableCell not correctly created on write access." + ); + } + + public function testOntheflyCreationRead_3() + { + $row = new ezcConsoleTableRow(); + $row[0]->content = 'test'; + $row[1]->format = 'test'; + $row[2]->align = ezcConsoleTable::ALIGN_CENTER; + $this->assertTrue( + count($row) == 3, + "ezcConsoleTableCell not correctly created on write access." + ); + } + + public function testOntheflyCreationWrite_1() + { + $row = new ezcConsoleTableRow(); + $row[0] = new ezcConsoleTableCell(); + $row[0]->content = 'test'; + $this->assertTrue( + count($row) == 1 && $row[0] instanceof ezcConsoleTableCell && $row[0]->content === 'test', + "ezcConsoleTableCell not correctly created on write access." + ); + } + + public function testNoOntheflyCreationIsset() + { + $row = new ezcConsoleTableRow(); + $this->assertEquals( + isset($row[0]), + false, + "ezcConsoleTableCell created on isset access." + ); + $this->assertEquals( + count($row), + 0, + "ezcConsoleTableCell created on isset access." + ); + } + + public function testForeach_1() + { + $row = new ezcConsoleTableRow(); + for ($i = 0; $i < 10; $i++) { + $row[$i]->content = 'Is '.$i; + } + $this->assertEquals( + count($row), + 10, + "ezcConsoleTableCells not correctly created on write access." + ); + foreach ($row as $id => $cell) { + $this->assertEquals( + 'Is ' . $id, + $cell->content, + "Cell with wrong content found on iteration." + ); + } + } + + public function testForeach_2() + { + $row = new ezcConsoleTableRow(); + for ($i = 0; $i < 20; $i += 2) { + $row[$i]->content = 'Is '.$i; + } + $this->assertEquals( + count($row), + 19, + "ezcConsoleTableCells." + ); + foreach ($row as $id => $cell) { + ; + $this->assertEquals( + 'Is ' . $id, + $cell->content, + "Cell with wrong content found on iteration." + ); + } + } + + public function testCount_1() + { + $row = new ezcConsoleTableRow(); + $row[0]->content = 0; + $this->assertEquals( + 1, + count($row), + "Did not count number of cells correctly" + ); + } + + public function testCount_2() + { + $row = new ezcConsoleTableRow(); + $row[1]->content = 0; + $this->assertEquals( + 2, + count($row), + "Did not count number of cells correctly" + ); + } + + public function testCount_3() + { + $row = new ezcConsoleTableRow(); + $row[10]->content = 0; + $this->assertEquals( + 11, + count($row), + "Did not count number of cells correctly" + ); + } + + public function testSetAllCellsProperties_1() + { + $row = new ezcConsoleTableRow(); + for ($i = 0; $i < 10; $i++) { + $row[$i]->content = $i; + } + + $row->align = ezcConsoleTable::ALIGN_CENTER; + + foreach ($this as $cell) { + $this->assertEquals( + ezcConsoleTable::ALIGN_CENTER, + $cell->align, + "Did not set alignment correctly for all contained cells." + ); + } + } + + public function testSetAllCellsProperties_2() + { + $row = new ezcConsoleTableRow(); + for ($i = 0; $i < 10; $i++) { + $row[$i]->content = $i; + } + + $row->format = 'headline'; + + foreach ($this as $cell) { + $this->assertEquals( + 'headline', + $cell->format, + "Did not set alignment correctly for all contained cells." + ); + } + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_test.php b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_test.php index 120ca109ee18b23d5cf945528463c87db30af846..e3b889d396554103a3a2f641e1e4e82c49a78644 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_test.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/ConsoleTools/tests/table_test.php @@ -1,534 +1,466 @@ -output = new ezcConsoleOutput(); - $formats = array( - 'red' => array( - 'color' => 'red', - 'style' => 'bold' - ), - 'blue' => array( - 'color' => 'blue', - 'style' => 'bold' - ), - 'green' => array( - 'color' => 'green', - 'style' => 'bold' - ), - 'magenta' => array( - 'color' => 'magenta', - 'style' => 'bold' - ), - ); - foreach ( $formats as $name => $format ) - { - foreach ( $format as $type => $val ) - { - $this->output->formats->$name->$type = $val; - } - } - } - - public function testTable1a() - { - $this->commonTableTest( - __FUNCTION__, - $this->tableData1, - array( 'cols' => count( $this->tableData1[0] ), 'width' => 80 ), - array( 'lineFormatHead' => 'green' ), - array( 0 ) - ); - } - - public function testTable1b() - { - $this->commonTableTest( - __FUNCTION__, - $this->tableData1, - array( 'cols' => count( $this->tableData1[0] ), 'width' => 40 ), - array( 'lineFormatHead' => 'red', ), - array( 0 ) - ); - } - - public function testTable2a() - { - $this->commonTableTest( - __FUNCTION__, - $this->tableData2, - array( 'cols' => count( $this->tableData2[0] ), 'width' => 60 ), - array( 'lineFormatHead' => 'magenta', 'defaultAlign' => ezcConsoleTable::ALIGN_RIGHT, 'widthType' => ezcConsoleTable::WIDTH_FIXED ) - ); - } - - public function testTable2b() - { - $this->commonTableTest( - __FUNCTION__, - $this->tableData2, - array( 'cols' => count( $this->tableData2[0] ), 'width' => 60 ), - array( 'lineFormatHead' => 'magenta', 'defaultAlign' => ezcConsoleTable::ALIGN_RIGHT ) - ); - } - - // Bug #8738: Unexpected behaviour with options->colPadding - public function testTableColPadding1() - { - $this->commonTableTest( - __FUNCTION__, - $this->tableData2, - array( 'width' => 100 ), - array( 'defaultAlign' => ezcConsoleTable::ALIGN_CENTER, 'colPadding' => '~~~', 'widthType' => ezcConsoleTable::WIDTH_FIXED ) - ); - } - - // Bug #8738: Unexpected behaviour with options->colPadding - public function testTableColPadding2() - { - $this->commonTableTest( - __FUNCTION__, - $this->tableData2, - array( 'width' => 100 ), - array( 'defaultAlign' => ezcConsoleTable::ALIGN_CENTER, 'colPadding' => '~~~' ) - ); - } - - public function testTable3a() - { - $this->commonTableTest( - __FUNCTION__, - $this->tableData3, - array( 'cols' => count( $this->tableData3[0] ), 'width' => 120 ), - array( 'lineFormatHead' => 'blue', 'defaultAlign' => ezcConsoleTable::ALIGN_CENTER, 'lineVertical' => '#', 'lineHorizontal' => '#', 'corner' => '#' ), - array( 0, 3 ) - ); - } - - public function testTable3b() - { - $this->commonTableTest( - __FUNCTION__, - $this->tableData3, - array( 'cols' => count( $this->tableData3[0] ), 'width' => 80 ), - array( 'lineFormatHead' => 'magenta', 'lineVertical' => 'v', 'lineHorizontal' => 'h', 'corner' => 'c' ), - array( 1, 2 ) - ); - } - - public function testTable4a() - { - $this->commonTableTest( - __FUNCTION__, - $this->tableData4, - array( 'cols' => count( $this->tableData4[0] ), 'width' => 120 ), - array( 'lineFormatHead' => 'blue', 'defaultAlign' => ezcConsoleTable::ALIGN_CENTER, 'colWrap' => ezcConsoleTable::WRAP_CUT ), - array( 0 ) - ); - } - - public function testTable4b() - { - $this->commonTableTest( - __FUNCTION__, - $this->tableData4, - array( 'cols' => count( $this->tableData4[0] ), 'width' => 120 ), - array( 'lineFormatHead' => 'blue', 'defaultAlign' => ezcConsoleTable::ALIGN_LEFT, 'colWrap' => ezcConsoleTable::WRAP_AUTO ), - array( 0 ) - ); - } - - public function testTable4c() - { - $this->commonTableTest( - __FUNCTION__, - $this->tableData4, - array( 'cols' => count( $this->tableData4[0] ), 'width' => 120 ), - array( 'lineFormatHead' => 'blue', 'defaultAlign' => ezcConsoleTable::ALIGN_CENTER, 'colWrap' => ezcConsoleTable::WRAP_CUT ), - array( 0 ) - ); - } - - public function testTableConfigurationFailure1 () - { - // Missing 'cols' setting - try - { - $table = new ezcConsoleTable( $this->output, null ); - } - catch (ezcBaseValueException $e) - { - $this->assertTrue( - true, - 'Wrong exception code thrown on missing setting.' - ); - return; - } - $this->fail( 'No or wrong exception thrown on missing setting.' ); - } - - public function testTableConfigurationFailure2 () - { - // 'cols' setting wrong type - try - { - $table = new ezcConsoleTable( $this->output, 'test' ); - } - catch (ezcBaseValueException $e) - { - $this->assertTrue( - true, - 'Wrong exception code thrown on missing setting.' - ); - return; - } - $this->fail( 'No or wrong exception thrown on wrong type for setting.' ); - } - - public function testTableConfigurationFailure3 () - { - // 'cols' setting out of range - try - { - $table = new ezcConsoleTable( $this->output, -10 ); - } - catch (ezcBaseValueException $e) - { - $this->assertTrue( - true, - 'Wrong exception code thrown on missing setting.' - ); - return; - } - $this->fail( 'No or wrong exception thrown on invalid value of setting.' ); - } - - public function testArrayAccess() - { - $table = new ezcConsoleTable( $this->output, 100 ); - $table[0]; - } - - public function testSetOptions_Success1() - { - $out = new ezcConsoleOutput(); - $table = new ezcConsoleTable( $out, 100 ); - try - { - $table->options->colWidth = array( 1, 2, 3 ); - $table->options->colWrap = ezcConsoleTable::WRAP_CUT; - $table->options->defaultAlign = ezcConsoleTable::ALIGN_CENTER; - $table->options->colPadding = ':'; - $table->options->widthType = ezcConsoleTable::WIDTH_FIXED; - $table->options->lineVertical = ':'; - $table->options->lineHorizontal = '-'; - $table->options->corner = 'o'; - $table->options->defaultFormat = 'test'; - $table->options->defaultBorderFormat = 'test2'; - } - catch ( Exception $e ) - { - $this->fail( "Exception while setting valid option: {$e->getMessage()}." ); - } - } - - public function testSetOptions_Success2() - { - try - { - $opt = new ezcConsoleTableOptions( - array( 1, 2, 3 ), - ezcConsoleTable::WRAP_CUT, - ezcConsoleTable::ALIGN_CENTER, - ':', - ezcConsoleTable::WIDTH_FIXED, - ':', - '-', - 'o', - 'test', - 'test2' - ); - } - catch ( Exception $e ) - { - $this->fail( "Exception while setting valid option: {$e->getMessage()}." ); - } - } - - public function testSetOptions_Success3() - { - try - { - $opt = new ezcConsoleTableOptions( - array( - "colWidth" => array( 1, 2, 3 ), - "colWrap" => ezcConsoleTable::WRAP_CUT, - "defaultAlign" => ezcConsoleTable::ALIGN_CENTER, - "colPadding" => ':', - "widthType" => ezcConsoleTable::WIDTH_FIXED, - "lineVertical" => ':', - "lineHorizontal" => '-', - "corner" => 'o', - "defaultFormat" => 'test', - "defaultBorderFormat" => 'test2' - ) - ); - } - catch ( Exception $e ) - { - $this->fail( "Exception while setting valid option: {$e->getMessage()}." ); - } - } - - public function testSetOptions_Failure() - { - $out = new ezcConsoleOutput(); - $table = new ezcConsoleTable( $out, 100 ); - - $exceptionThrown = false; - - try - { - $table->options->colWidth = 'test'; - } - catch ( ezcBaseSettingValueException $e) - { - $exceptionThrown = true; - } - if ( !$exceptionThrown ) - { - $this->fail( 'No exception thrown on invalid setting for .'); - } - $exceptionThrown = false; - - try - { - $table->options->colWrap = 100; - } - catch ( ezcBaseSettingValueException $e) - { - $exceptionThrown = true; - } - if ( !$exceptionThrown ) - { - $this->fail( 'No exception thrown on invalid setting for .'); - } - $exceptionThrown = false; - - try - { - $table->options->defaultAlign = 101; - } - catch ( ezcBaseSettingValueException $e) - { - $exceptionThrown = true; - } - if ( !$exceptionThrown ) - { - $this->fail( 'No exception thrown on invalid setting for .'); - } - $exceptionThrown = false; - - try - { - $table->options->colPadding = 102; - } - catch ( ezcBaseSettingValueException $e) - { - $exceptionThrown = true; - } - if ( !$exceptionThrown ) - { - $this->fail( 'No exception thrown on invalid setting for .'); - } - $exceptionThrown = false; - - try - { - $table->options->widthType = 103; - } - catch ( ezcBaseSettingValueException $e) - { - $exceptionThrown = true; - } - if ( !$exceptionThrown ) - { - $this->fail( 'No exception thrown on invalid setting for .'); - } - $exceptionThrown = false; - - try - { - $table->options->lineVertical = 104; - } - catch ( ezcBaseSettingValueException $e) - { - $exceptionThrown = true; - } - if ( !$exceptionThrown ) - { - $this->fail( 'No exception thrown on invalid setting for .'); - } - $exceptionThrown = false; - - try - { - $table->options->lineHorizontal = 105; - } - catch ( ezcBaseSettingValueException $e) - { - $exceptionThrown = true; - } - if ( !$exceptionThrown ) - { - $this->fail( 'No exception thrown on invalid setting for .'); - } - $exceptionThrown = false; - - try - { - $table->options->corner = 106; - } - catch ( ezcBaseSettingValueException $e) - { - $exceptionThrown = true; - } - if ( !$exceptionThrown ) - { - $this->fail( 'No exception thrown on invalid setting for .'); - } - $exceptionThrown = false; - - try - { - $table->options->defaultFormat = array(); - } - catch ( ezcBaseSettingValueException $e) - { - $exceptionThrown = true; - } - if ( !$exceptionThrown ) - { - $this->fail( 'No exception thrown on invalid setting for .'); - } - $exceptionThrown = false; - - try - { - $table->options->defaultBorderFormat = true; - } - catch ( ezcBaseSettingValueException $e) - { - $exceptionThrown = true; - } - if ( !$exceptionThrown ) - { - $this->fail( 'No exception thrown on invalid setting for .'); - } - $exceptionThrown = false; - - } - - private function commonTableTest( $refFile, $tableData, $settings, $options, $headrows = array() ) - { - $table = new ezcConsoleTable( - $this->output, - $settings['width'] - ); - - // Set options - foreach ( $options as $key => $val ) - { - if ( $key == 'lineFormatHead' ) - { - continue; - } - $table->options->$key = $val; - } - - // Add data - for ( $i = 0; $i < count( $tableData ); $i++ ) - { - for ( $j = 0; $j < count( $tableData[$i]); $j++ ) - { - $table[$i][$j]->content = $tableData[$i][$j]; - } - } - - // Set a specific cell format - $table[0][0]->format = 'red'; - - // Apply head format to head rows - foreach ( $headrows as $row ) - { - $table[$row]->borderFormat = isset( $options['lineFormatHead'] ) ? $options['lineFormatHead'] : 'default'; - } - - // For visual inspection, uncomment this block -// echo "\n\n"; -// echo "Old $refFile:\n:"; -// echo file_get_contents( dirname( __FILE__ ) . '/data/' . $refFile . '.dat' ); -// echo "New $refFile:\n:"; -// echo implode( "\n", $table->getTable() ); -// echo "\n\n"; - - // To prepare test files, uncomment this block - // file_put_contents( dirname( __FILE__ ) . '/data/' . $refFile . '.dat', implode( "\n", $table->getTable() ) ); - - // For test assertion, uncomment this block - $this->assertEquals( - file_get_contents( dirname( __FILE__ ) . '/data/' . $refFile . '.dat' ), - implode( "\n", $table->getTable() ), - 'Table not correctly generated for ' . $refFile . '.' - ); - - } -} -?> +output = new ezcConsoleOutput(); + $formats = array( + 'red' => array( + 'color' => 'red', + 'style' => 'bold' + ), + 'blue' => array( + 'color' => 'blue', + 'style' => 'bold' + ), + 'green' => array( + 'color' => 'green', + 'style' => 'bold' + ), + 'magenta' => array( + 'color' => 'magenta', + 'style' => 'bold' + ), + ); + foreach ($formats as $name => $format) { + foreach ($format as $type => $val) { + $this->output->formats->$name->$type = $val; + } + } + } + + public function testTable1a() + { + $this->commonTableTest( + __FUNCTION__, + $this->tableData1, + array( 'cols' => count($this->tableData1[0]), 'width' => 80 ), + array( 'lineFormatHead' => 'green' ), + array( 0 ) + ); + } + + public function testTable1b() + { + $this->commonTableTest( + __FUNCTION__, + $this->tableData1, + array( 'cols' => count($this->tableData1[0]), 'width' => 40 ), + array( 'lineFormatHead' => 'red', ), + array( 0 ) + ); + } + + public function testTable2a() + { + $this->commonTableTest( + __FUNCTION__, + $this->tableData2, + array( 'cols' => count($this->tableData2[0]), 'width' => 60 ), + array( 'lineFormatHead' => 'magenta', 'defaultAlign' => ezcConsoleTable::ALIGN_RIGHT, 'widthType' => ezcConsoleTable::WIDTH_FIXED ) + ); + } + + public function testTable2b() + { + $this->commonTableTest( + __FUNCTION__, + $this->tableData2, + array( 'cols' => count($this->tableData2[0]), 'width' => 60 ), + array( 'lineFormatHead' => 'magenta', 'defaultAlign' => ezcConsoleTable::ALIGN_RIGHT ) + ); + } + + // Bug #8738: Unexpected behaviour with options->colPadding + public function testTableColPadding1() + { + $this->commonTableTest( + __FUNCTION__, + $this->tableData2, + array( 'width' => 100 ), + array( 'defaultAlign' => ezcConsoleTable::ALIGN_CENTER, 'colPadding' => '~~~', 'widthType' => ezcConsoleTable::WIDTH_FIXED ) + ); + } + + // Bug #8738: Unexpected behaviour with options->colPadding + public function testTableColPadding2() + { + $this->commonTableTest( + __FUNCTION__, + $this->tableData2, + array( 'width' => 100 ), + array( 'defaultAlign' => ezcConsoleTable::ALIGN_CENTER, 'colPadding' => '~~~' ) + ); + } + + public function testTable3a() + { + $this->commonTableTest( + __FUNCTION__, + $this->tableData3, + array( 'cols' => count($this->tableData3[0]), 'width' => 120 ), + array( 'lineFormatHead' => 'blue', 'defaultAlign' => ezcConsoleTable::ALIGN_CENTER, 'lineVertical' => '#', 'lineHorizontal' => '#', 'corner' => '#' ), + array( 0, 3 ) + ); + } + + public function testTable3b() + { + $this->commonTableTest( + __FUNCTION__, + $this->tableData3, + array( 'cols' => count($this->tableData3[0]), 'width' => 80 ), + array( 'lineFormatHead' => 'magenta', 'lineVertical' => 'v', 'lineHorizontal' => 'h', 'corner' => 'c' ), + array( 1, 2 ) + ); + } + + public function testTable4a() + { + $this->commonTableTest( + __FUNCTION__, + $this->tableData4, + array( 'cols' => count($this->tableData4[0]), 'width' => 120 ), + array( 'lineFormatHead' => 'blue', 'defaultAlign' => ezcConsoleTable::ALIGN_CENTER, 'colWrap' => ezcConsoleTable::WRAP_CUT ), + array( 0 ) + ); + } + + public function testTable4b() + { + $this->commonTableTest( + __FUNCTION__, + $this->tableData4, + array( 'cols' => count($this->tableData4[0]), 'width' => 120 ), + array( 'lineFormatHead' => 'blue', 'defaultAlign' => ezcConsoleTable::ALIGN_LEFT, 'colWrap' => ezcConsoleTable::WRAP_AUTO ), + array( 0 ) + ); + } + + public function testTable4c() + { + $this->commonTableTest( + __FUNCTION__, + $this->tableData4, + array( 'cols' => count($this->tableData4[0]), 'width' => 120 ), + array( 'lineFormatHead' => 'blue', 'defaultAlign' => ezcConsoleTable::ALIGN_CENTER, 'colWrap' => ezcConsoleTable::WRAP_CUT ), + array( 0 ) + ); + } + + public function testTableConfigurationFailure1() + { + // Missing 'cols' setting + try { + $table = new ezcConsoleTable($this->output, null); + } catch (ezcBaseValueException $e) { + $this->assertTrue( + true, + 'Wrong exception code thrown on missing setting.' + ); + return; + } + $this->fail('No or wrong exception thrown on missing setting.'); + } + + public function testTableConfigurationFailure2() + { + // 'cols' setting wrong type + try { + $table = new ezcConsoleTable($this->output, 'test'); + } catch (ezcBaseValueException $e) { + $this->assertTrue( + true, + 'Wrong exception code thrown on missing setting.' + ); + return; + } + $this->fail('No or wrong exception thrown on wrong type for setting.'); + } + + public function testTableConfigurationFailure3() + { + // 'cols' setting out of range + try { + $table = new ezcConsoleTable($this->output, -10); + } catch (ezcBaseValueException $e) { + $this->assertTrue( + true, + 'Wrong exception code thrown on missing setting.' + ); + return; + } + $this->fail('No or wrong exception thrown on invalid value of setting.'); + } + + public function testArrayAccess() + { + $table = new ezcConsoleTable($this->output, 100); + $table[0]; + } + + public function testSetOptions_Success1() + { + $out = new ezcConsoleOutput(); + $table = new ezcConsoleTable($out, 100); + try { + $table->options->colWidth = array( 1, 2, 3 ); + $table->options->colWrap = ezcConsoleTable::WRAP_CUT; + $table->options->defaultAlign = ezcConsoleTable::ALIGN_CENTER; + $table->options->colPadding = ':'; + $table->options->widthType = ezcConsoleTable::WIDTH_FIXED; + $table->options->lineVertical = ':'; + $table->options->lineHorizontal = '-'; + $table->options->corner = 'o'; + $table->options->defaultFormat = 'test'; + $table->options->defaultBorderFormat = 'test2'; + } catch (Exception $e) { + $this->fail("Exception while setting valid option: {$e->getMessage()}."); + } + } + + public function testSetOptions_Success2() + { + try { + $opt = new ezcConsoleTableOptions( + array( 1, 2, 3 ), + ezcConsoleTable::WRAP_CUT, + ezcConsoleTable::ALIGN_CENTER, + ':', + ezcConsoleTable::WIDTH_FIXED, + ':', + '-', + 'o', + 'test', + 'test2' + ); + } catch (Exception $e) { + $this->fail("Exception while setting valid option: {$e->getMessage()}."); + } + } + + public function testSetOptions_Success3() + { + try { + $opt = new ezcConsoleTableOptions( + array( + "colWidth" => array( 1, 2, 3 ), + "colWrap" => ezcConsoleTable::WRAP_CUT, + "defaultAlign" => ezcConsoleTable::ALIGN_CENTER, + "colPadding" => ':', + "widthType" => ezcConsoleTable::WIDTH_FIXED, + "lineVertical" => ':', + "lineHorizontal" => '-', + "corner" => 'o', + "defaultFormat" => 'test', + "defaultBorderFormat" => 'test2' + ) + ); + } catch (Exception $e) { + $this->fail("Exception while setting valid option: {$e->getMessage()}."); + } + } + + public function testSetOptions_Failure() + { + $out = new ezcConsoleOutput(); + $table = new ezcConsoleTable($out, 100); + + $exceptionThrown = false; + + try { + $table->options->colWidth = 'test'; + } catch (ezcBaseSettingValueException $e) { + $exceptionThrown = true; + } + if (!$exceptionThrown) { + $this->fail('No exception thrown on invalid setting for .'); + } + $exceptionThrown = false; + + try { + $table->options->colWrap = 100; + } catch (ezcBaseSettingValueException $e) { + $exceptionThrown = true; + } + if (!$exceptionThrown) { + $this->fail('No exception thrown on invalid setting for .'); + } + $exceptionThrown = false; + + try { + $table->options->defaultAlign = 101; + } catch (ezcBaseSettingValueException $e) { + $exceptionThrown = true; + } + if (!$exceptionThrown) { + $this->fail('No exception thrown on invalid setting for .'); + } + $exceptionThrown = false; + + try { + $table->options->colPadding = 102; + } catch (ezcBaseSettingValueException $e) { + $exceptionThrown = true; + } + if (!$exceptionThrown) { + $this->fail('No exception thrown on invalid setting for .'); + } + $exceptionThrown = false; + + try { + $table->options->widthType = 103; + } catch (ezcBaseSettingValueException $e) { + $exceptionThrown = true; + } + if (!$exceptionThrown) { + $this->fail('No exception thrown on invalid setting for .'); + } + $exceptionThrown = false; + + try { + $table->options->lineVertical = 104; + } catch (ezcBaseSettingValueException $e) { + $exceptionThrown = true; + } + if (!$exceptionThrown) { + $this->fail('No exception thrown on invalid setting for .'); + } + $exceptionThrown = false; + + try { + $table->options->lineHorizontal = 105; + } catch (ezcBaseSettingValueException $e) { + $exceptionThrown = true; + } + if (!$exceptionThrown) { + $this->fail('No exception thrown on invalid setting for .'); + } + $exceptionThrown = false; + + try { + $table->options->corner = 106; + } catch (ezcBaseSettingValueException $e) { + $exceptionThrown = true; + } + if (!$exceptionThrown) { + $this->fail('No exception thrown on invalid setting for .'); + } + $exceptionThrown = false; + + try { + $table->options->defaultFormat = array(); + } catch (ezcBaseSettingValueException $e) { + $exceptionThrown = true; + } + if (!$exceptionThrown) { + $this->fail('No exception thrown on invalid setting for .'); + } + $exceptionThrown = false; + + try { + $table->options->defaultBorderFormat = true; + } catch (ezcBaseSettingValueException $e) { + $exceptionThrown = true; + } + if (!$exceptionThrown) { + $this->fail('No exception thrown on invalid setting for .'); + } + $exceptionThrown = false; + } + + private function commonTableTest($refFile, $tableData, $settings, $options, $headrows = array()) + { + $table = new ezcConsoleTable( + $this->output, + $settings['width'] + ); + + // Set options + foreach ($options as $key => $val) { + if ($key == 'lineFormatHead') { + continue; + } + $table->options->$key = $val; + } + + // Add data + for ($i = 0; $i < count($tableData); $i++) { + for ($j = 0; $j < count($tableData[$i]); $j++) { + $table[$i][$j]->content = $tableData[$i][$j]; + } + } + + // Set a specific cell format + $table[0][0]->format = 'red'; + + // Apply head format to head rows + foreach ($headrows as $row) { + $table[$row]->borderFormat = isset($options['lineFormatHead']) ? $options['lineFormatHead'] : 'default'; + } + + // For visual inspection, uncomment this block +// echo "\n\n"; +// echo "Old $refFile:\n:"; +// echo file_get_contents( dirname( __FILE__ ) . '/data/' . $refFile . '.dat' ); +// echo "New $refFile:\n:"; +// echo implode( "\n", $table->getTable() ); +// echo "\n\n"; + + // To prepare test files, uncomment this block + // file_put_contents( dirname( __FILE__ ) . '/data/' . $refFile . '.dat', implode( "\n", $table->getTable() ) ); + + // For test assertion, uncomment this block + $this->assertEquals( + file_get_contents(dirname(__FILE__) . '/data/' . $refFile . '.dat'), + implode("\n", $table->getTable()), + 'Table not correctly generated for ' . $refFile . '.' + ); + } +} diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/archive_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/archive_autoload.php index 9527b2d12d83ca47e9fcdf3ffd2144262d5c0476..b41a87bd1e960354a9a414bfbea80328d90e6b21 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/archive_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/archive_autoload.php @@ -1,53 +1,50 @@ - "Archive/archive.php", - "ezcArchiveEntry" => "Archive/archive_entry.php", - - "ezcArchiveFile" => "Archive/file/file.php", - "ezcArchiveBlockFile" => "Archive/file/block_file.php", - "ezcArchiveCharacterFile" => "Archive/file/character_file.php", - - "ezcArchiveFileStructure" => "Archive/file_structure.php", - - "ezcArchiveV7Tar" => "Archive/tar/v7_tar.php", - "ezcArchiveUstarTar" => "Archive/tar/ustar_tar.php", - "ezcArchivePaxTar" => "Archive/tar/pax_tar.php", - "ezcArchiveGnuTar" => "Archive/tar/gnu_tar.php", - - "ezcArchiveZip" => "Archive/zip/zip.php", - - "ezcArchiveException" => "Archive/exceptions/archive_exception.php", - "ezcArchiveFileException" => "Archive/exceptions/file_exception.php", - "ezcArchiveValueException" => "Archive/exceptions/archive_value.php", - "ezcArchiveEmptyException" => "Archive/exceptions/archive_empty.php", - "ezcArchiveUnknownTypeException" => "Archive/exceptions/archive_unknown_type.php", - "ezcArchiveEntryPrefixException" => "Archive/exceptions/archive_entry_prefix.php", - "ezcArchiveChecksumException" => "Archive/exceptions/archive_checksum.php", - "ezcArchiveBlockSizeException" => "Archive/exceptions/archive_block_size.php", - "ezcArchiveIoException" => "Archive/exceptions/archive_io.php", - - "ezcArchiveLocalFileHeader" => "Archive/zip/headers/zip_local_file.php", - "ezcArchiveCentralDirectoryHeader" => "Archive/zip/headers/zip_central_directory.php", - "ezcArchiveCentralDirectoryEndHeader" => "Archive/zip/headers/zip_central_directory_end.php", - - "ezcArchiveV7Header" => "Archive/tar/headers/tar_v7.php", - "ezcArchiveUstarHeader" => "Archive/tar/headers/tar_ustar.php", - "ezcArchivePaxHeader" => "Archive/tar/headers/tar_pax.php", - "ezcArchiveGnuHeader" => "Archive/tar/headers/tar_gnu.php", - - "ezcArchiveStatMode" => "Archive/stat_mode.php", - "ezcArchiveChecksums" => "Archive/checksums.php", - "ezcArchiveMime" => "Archive/archive_mime.php" - ); - - -?> + "Archive/archive.php", + "ezcArchiveEntry" => "Archive/archive_entry.php", + + "ezcArchiveFile" => "Archive/file/file.php", + "ezcArchiveBlockFile" => "Archive/file/block_file.php", + "ezcArchiveCharacterFile" => "Archive/file/character_file.php", + + "ezcArchiveFileStructure" => "Archive/file_structure.php", + + "ezcArchiveV7Tar" => "Archive/tar/v7_tar.php", + "ezcArchiveUstarTar" => "Archive/tar/ustar_tar.php", + "ezcArchivePaxTar" => "Archive/tar/pax_tar.php", + "ezcArchiveGnuTar" => "Archive/tar/gnu_tar.php", + + "ezcArchiveZip" => "Archive/zip/zip.php", + + "ezcArchiveException" => "Archive/exceptions/archive_exception.php", + "ezcArchiveFileException" => "Archive/exceptions/file_exception.php", + "ezcArchiveValueException" => "Archive/exceptions/archive_value.php", + "ezcArchiveEmptyException" => "Archive/exceptions/archive_empty.php", + "ezcArchiveUnknownTypeException" => "Archive/exceptions/archive_unknown_type.php", + "ezcArchiveEntryPrefixException" => "Archive/exceptions/archive_entry_prefix.php", + "ezcArchiveChecksumException" => "Archive/exceptions/archive_checksum.php", + "ezcArchiveBlockSizeException" => "Archive/exceptions/archive_block_size.php", + "ezcArchiveIoException" => "Archive/exceptions/archive_io.php", + + "ezcArchiveLocalFileHeader" => "Archive/zip/headers/zip_local_file.php", + "ezcArchiveCentralDirectoryHeader" => "Archive/zip/headers/zip_central_directory.php", + "ezcArchiveCentralDirectoryEndHeader" => "Archive/zip/headers/zip_central_directory_end.php", + + "ezcArchiveV7Header" => "Archive/tar/headers/tar_v7.php", + "ezcArchiveUstarHeader" => "Archive/tar/headers/tar_ustar.php", + "ezcArchivePaxHeader" => "Archive/tar/headers/tar_pax.php", + "ezcArchiveGnuHeader" => "Archive/tar/headers/tar_gnu.php", + + "ezcArchiveStatMode" => "Archive/stat_mode.php", + "ezcArchiveChecksums" => "Archive/checksums.php", + "ezcArchiveMime" => "Archive/archive_mime.php" + ); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/base_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/base_autoload.php index 2dafd506d30efb639410f0999989049f1252ff3e..49b809741f6db275ddea79d5c5a0d84399dd4560 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/base_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/base_autoload.php @@ -1,26 +1,25 @@ - 'Base/exceptions/exception.php', - 'ezcBaseFileException' => 'Base/exceptions/file_exception.php', - - 'ezcBaseFileNotFoundException' => 'Base/exceptions/file_not_found.php', - 'ezcBaseFileIoException' => 'Base/exceptions/file_io.php', - 'ezcBaseFilePermissionException' => 'Base/exceptions/file_permission.php', - 'ezcBasePropertyPermissionException' => 'Base/exceptions/property_permission.php', - 'ezcBasePropertyNotFoundException' => 'Base/exceptions/property_not_found.php', - 'ezcBaseSettingNotFoundException' => 'Base/exceptions/setting_not_found.php', - 'ezcBaseSettingValueException' => 'Base/exceptions/setting_value.php', - 'ezcBaseValueException' => 'Base/exceptions/value.php', - - 'ezcBaseOptions' => 'Base/options.php', - 'ezcBaseStruct' => 'Base/struct.php', -); -?> + 'Base/exceptions/exception.php', + 'ezcBaseFileException' => 'Base/exceptions/file_exception.php', + + 'ezcBaseFileNotFoundException' => 'Base/exceptions/file_not_found.php', + 'ezcBaseFileIoException' => 'Base/exceptions/file_io.php', + 'ezcBaseFilePermissionException' => 'Base/exceptions/file_permission.php', + 'ezcBasePropertyPermissionException' => 'Base/exceptions/property_permission.php', + 'ezcBasePropertyNotFoundException' => 'Base/exceptions/property_not_found.php', + 'ezcBaseSettingNotFoundException' => 'Base/exceptions/setting_not_found.php', + 'ezcBaseSettingValueException' => 'Base/exceptions/setting_value.php', + 'ezcBaseValueException' => 'Base/exceptions/value.php', + + 'ezcBaseOptions' => 'Base/options.php', + 'ezcBaseStruct' => 'Base/struct.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/cache_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/cache_autoload.php index 07d8bb3e25dff065d083e733d1a4f997be2834c5..9bba9ba3c91613f1ff192d522802c4829f723900 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/cache_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/cache_autoload.php @@ -1,27 +1,26 @@ - 'Cache/manager.php', - 'ezcCacheStorage' => 'Cache/storage.php', - 'ezcCacheStorageOptions' => 'Cache/options/storage.php', - 'ezcCacheStorageFile' => 'Cache/storage/file.php', - 'ezcCacheStorageFileArray' => 'Cache/storage/file/array.php', - 'ezcCacheStorageFileEvalArray' => 'Cache/storage/file/eval_array.php', - 'ezcCacheStorageFilePlain' => 'Cache/storage/file/plain.php', - 'ezcCacheException' => 'Cache/exceptions/exception.php', - 'ezcCacheInvalidDataException' => 'Cache/exceptions/invalid_data.php', - 'ezcCacheInvalidIdException' => 'Cache/exceptions/invalid_id.php', - 'ezcCacheInvalidLocationException' => 'Cache/exceptions/invalid_location.php', - 'ezcCacheInvalidStorageClassException' => 'Cache/exceptions/invalid_storage_class.php', - 'ezcCacheUsedLocationException' => 'Cache/exceptions/used_location.php', -); -?> + 'Cache/manager.php', + 'ezcCacheStorage' => 'Cache/storage.php', + 'ezcCacheStorageOptions' => 'Cache/options/storage.php', + 'ezcCacheStorageFile' => 'Cache/storage/file.php', + 'ezcCacheStorageFileArray' => 'Cache/storage/file/array.php', + 'ezcCacheStorageFileEvalArray' => 'Cache/storage/file/eval_array.php', + 'ezcCacheStorageFilePlain' => 'Cache/storage/file/plain.php', + 'ezcCacheException' => 'Cache/exceptions/exception.php', + 'ezcCacheInvalidDataException' => 'Cache/exceptions/invalid_data.php', + 'ezcCacheInvalidIdException' => 'Cache/exceptions/invalid_id.php', + 'ezcCacheInvalidLocationException' => 'Cache/exceptions/invalid_location.php', + 'ezcCacheInvalidStorageClassException' => 'Cache/exceptions/invalid_storage_class.php', + 'ezcCacheUsedLocationException' => 'Cache/exceptions/used_location.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/configuration_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/configuration_autoload.php index 1afa2b62c20fcc3b6dd8ea190da0548801a6faea..f8215f32c8cb2fed71542ac99d4b724f907bbb1f 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/configuration_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/configuration_autoload.php @@ -1,42 +1,41 @@ - 'Configuration/configuration.php', - 'ezcConfigurationArrayReader' => 'Configuration/array/array_reader.php', - 'ezcConfigurationArrayWriter' => 'Configuration/array/array_writer.php', - 'ezcConfigurationFileReader' => 'Configuration/file_reader.php', - 'ezcConfigurationFileWriter' => 'Configuration/file_writer.php', - 'ezcConfigurationIniParser' => 'Configuration/ini/ini_parser.php', - 'ezcConfigurationIniReader' => 'Configuration/ini/ini_reader.php', - 'ezcConfigurationIniWriter' => 'Configuration/ini/ini_writer.php', - 'ezcConfigurationIniItem' => 'Configuration/structs/ini_item.php', - 'ezcConfigurationManager' => 'Configuration/configuration_manager.php', - 'ezcConfigurationReader' => 'Configuration/interfaces/reader.php', - 'ezcConfigurationValidationItem' => 'Configuration/structs/validation_item.php', - 'ezcConfigurationValidationResult' => 'Configuration/validation_result.php', - 'ezcConfigurationWriter' => 'Configuration/interfaces/writer.php', - - 'ezcConfigurationException' => 'Configuration/exceptions/exception.php', - 'ezcConfigurationGroupExistsAlreadyException' => 'Configuration/exceptions/group_exists_already.php', - 'ezcConfigurationInvalidReaderClassException' => 'Configuration/exceptions/invalid_reader_class.php', - 'ezcConfigurationInvalidSuffixException' => 'Configuration/exceptions/invalid_suffix.php', - 'ezcConfigurationManagerNotInitializedException'=> 'Configuration/exceptions/manager_no_init.php', - 'ezcConfigurationNoConfigException' => 'Configuration/exceptions/no_config.php', - 'ezcConfigurationNoConfigObjectException' => 'Configuration/exceptions/no_config_object.php', - 'ezcConfigurationParseErrorException' => 'Configuration/exceptions/parse_error.php', - 'ezcConfigurationReadFailedException' => 'Configuration/exceptions/read_failed.php', - 'ezcConfigurationSettingWrongTypeException' => 'Configuration/exceptions/setting_wrong_type.php', - 'ezcConfigurationSettingnameNotStringException' => 'Configuration/exceptions/settingname_not_string.php', - 'ezcConfigurationUnknownConfigException' => 'Configuration/exceptions/unknown_config.php', - 'ezcConfigurationUnknownGroupException' => 'Configuration/exceptions/unknown_group.php', - 'ezcConfigurationUnknownSettingException' => 'Configuration/exceptions/unknown_setting.php', - 'ezcConfigurationWriteFailedException' => 'Configuration/exceptions/write_failed.php', -); -?> + 'Configuration/configuration.php', + 'ezcConfigurationArrayReader' => 'Configuration/array/array_reader.php', + 'ezcConfigurationArrayWriter' => 'Configuration/array/array_writer.php', + 'ezcConfigurationFileReader' => 'Configuration/file_reader.php', + 'ezcConfigurationFileWriter' => 'Configuration/file_writer.php', + 'ezcConfigurationIniParser' => 'Configuration/ini/ini_parser.php', + 'ezcConfigurationIniReader' => 'Configuration/ini/ini_reader.php', + 'ezcConfigurationIniWriter' => 'Configuration/ini/ini_writer.php', + 'ezcConfigurationIniItem' => 'Configuration/structs/ini_item.php', + 'ezcConfigurationManager' => 'Configuration/configuration_manager.php', + 'ezcConfigurationReader' => 'Configuration/interfaces/reader.php', + 'ezcConfigurationValidationItem' => 'Configuration/structs/validation_item.php', + 'ezcConfigurationValidationResult' => 'Configuration/validation_result.php', + 'ezcConfigurationWriter' => 'Configuration/interfaces/writer.php', + + 'ezcConfigurationException' => 'Configuration/exceptions/exception.php', + 'ezcConfigurationGroupExistsAlreadyException' => 'Configuration/exceptions/group_exists_already.php', + 'ezcConfigurationInvalidReaderClassException' => 'Configuration/exceptions/invalid_reader_class.php', + 'ezcConfigurationInvalidSuffixException' => 'Configuration/exceptions/invalid_suffix.php', + 'ezcConfigurationManagerNotInitializedException'=> 'Configuration/exceptions/manager_no_init.php', + 'ezcConfigurationNoConfigException' => 'Configuration/exceptions/no_config.php', + 'ezcConfigurationNoConfigObjectException' => 'Configuration/exceptions/no_config_object.php', + 'ezcConfigurationParseErrorException' => 'Configuration/exceptions/parse_error.php', + 'ezcConfigurationReadFailedException' => 'Configuration/exceptions/read_failed.php', + 'ezcConfigurationSettingWrongTypeException' => 'Configuration/exceptions/setting_wrong_type.php', + 'ezcConfigurationSettingnameNotStringException' => 'Configuration/exceptions/settingname_not_string.php', + 'ezcConfigurationUnknownConfigException' => 'Configuration/exceptions/unknown_config.php', + 'ezcConfigurationUnknownGroupException' => 'Configuration/exceptions/unknown_group.php', + 'ezcConfigurationUnknownSettingException' => 'Configuration/exceptions/unknown_setting.php', + 'ezcConfigurationWriteFailedException' => 'Configuration/exceptions/write_failed.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/console_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/console_autoload.php index 74c31f7792368aa7b87728b3f98a605d1bdfdfcd..585372cd645cda84063ca34d870a4f72b77ce62c 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/console_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/console_autoload.php @@ -1,51 +1,49 @@ - 'ConsoleTools/output.php', - 'ezcConsoleOutputOptions' => 'ConsoleTools/options/output.php', - 'ezcConsoleOutputFormats' => 'ConsoleTools/structs/output_formats.php', - 'ezcConsoleOutputFormat' => 'ConsoleTools/structs/output_format.php', - 'ezcConsoleInput' => 'ConsoleTools/input.php', - 'ezcConsoleOption' => 'ConsoleTools/input/option.php', - 'ezcConsoleOptionRule' => 'ConsoleTools/structs/option_rule.php', - 'ezcConsoleTable' => 'ConsoleTools/table.php', - 'ezcConsoleTableRow' => 'ConsoleTools/table/row.php', - 'ezcConsoleTableCell' => 'ConsoleTools/table/cell.php', - 'ezcConsoleTableOptions' => 'ConsoleTools/options/table.php', - 'ezcConsoleProgressbar' => 'ConsoleTools/progressbar.php', - 'ezcConsoleProgressbarOptions' => 'ConsoleTools/options/progressbar.php', - 'ezcConsoleProgressMonitor' => 'ConsoleTools/progressmonitor.php', - 'ezcConsoleProgressMonitorOptions' => 'ConsoleTools/options/progressmonitor.php', - 'ezcConsoleStatusbar' => 'ConsoleTools/statusbar.php', - 'ezcConsoleStatusbarOptions' => 'ConsoleTools/options/statusbar.php', - - 'ezcConsoleException' => 'ConsoleTools/exceptions/exception.php', - 'ezcConsoleNoPositionStoredException' => 'ConsoleTools/exceptions/no_position_stored.php', - - 'ezcConsoleOptionAlreadyRegisteredException' => 'ConsoleTools/exceptions/option_already_registered.php', - 'ezcConsoleOptionNoAliasException' => 'ConsoleTools/exceptions/option_no_alias.php', - 'ezcConsoleOptionStringNotWellformedException' => 'ConsoleTools/exceptions/option_string_not_wellformed.php', - 'ezcConsoleInvalidOptionNameException' => 'ConsoleTools/exceptions/invalid_option_name.php', - - 'ezcConsoleOptionException' => 'ConsoleTools/exceptions/option.php', - - 'ezcConsoleOptionArgumentsViolationException' => 'ConsoleTools/exceptions/option_arguments_violation.php', - 'ezcConsoleOptionDependencyViolationException' => 'ConsoleTools/exceptions/option_dependency_violation.php', - 'ezcConsoleOptionExclusionViolationException' => 'ConsoleTools/exceptions/option_exclusion_violation.php', - 'ezcConsoleOptionMandatoryViolationException' => 'ConsoleTools/exceptions/option_mandatory_violation.php', - 'ezcConsoleOptionTypeViolationException' => 'ConsoleTools/exceptions/option_type_violation.php', - 'ezcConsoleOptionMissingValueException' => 'ConsoleTools/exceptions/option_missing_value.php', - 'ezcConsoleOptionNotExistsException' => 'ConsoleTools/exceptions/option_not_exists.php', - 'ezcConsoleOptionTooManyValuesException' => 'ConsoleTools/exceptions/option_too_many_values.php', -); - -?> + 'ConsoleTools/output.php', + 'ezcConsoleOutputOptions' => 'ConsoleTools/options/output.php', + 'ezcConsoleOutputFormats' => 'ConsoleTools/structs/output_formats.php', + 'ezcConsoleOutputFormat' => 'ConsoleTools/structs/output_format.php', + 'ezcConsoleInput' => 'ConsoleTools/input.php', + 'ezcConsoleOption' => 'ConsoleTools/input/option.php', + 'ezcConsoleOptionRule' => 'ConsoleTools/structs/option_rule.php', + 'ezcConsoleTable' => 'ConsoleTools/table.php', + 'ezcConsoleTableRow' => 'ConsoleTools/table/row.php', + 'ezcConsoleTableCell' => 'ConsoleTools/table/cell.php', + 'ezcConsoleTableOptions' => 'ConsoleTools/options/table.php', + 'ezcConsoleProgressbar' => 'ConsoleTools/progressbar.php', + 'ezcConsoleProgressbarOptions' => 'ConsoleTools/options/progressbar.php', + 'ezcConsoleProgressMonitor' => 'ConsoleTools/progressmonitor.php', + 'ezcConsoleProgressMonitorOptions' => 'ConsoleTools/options/progressmonitor.php', + 'ezcConsoleStatusbar' => 'ConsoleTools/statusbar.php', + 'ezcConsoleStatusbarOptions' => 'ConsoleTools/options/statusbar.php', + + 'ezcConsoleException' => 'ConsoleTools/exceptions/exception.php', + 'ezcConsoleNoPositionStoredException' => 'ConsoleTools/exceptions/no_position_stored.php', + + 'ezcConsoleOptionAlreadyRegisteredException' => 'ConsoleTools/exceptions/option_already_registered.php', + 'ezcConsoleOptionNoAliasException' => 'ConsoleTools/exceptions/option_no_alias.php', + 'ezcConsoleOptionStringNotWellformedException' => 'ConsoleTools/exceptions/option_string_not_wellformed.php', + 'ezcConsoleInvalidOptionNameException' => 'ConsoleTools/exceptions/invalid_option_name.php', + + 'ezcConsoleOptionException' => 'ConsoleTools/exceptions/option.php', + + 'ezcConsoleOptionArgumentsViolationException' => 'ConsoleTools/exceptions/option_arguments_violation.php', + 'ezcConsoleOptionDependencyViolationException' => 'ConsoleTools/exceptions/option_dependency_violation.php', + 'ezcConsoleOptionExclusionViolationException' => 'ConsoleTools/exceptions/option_exclusion_violation.php', + 'ezcConsoleOptionMandatoryViolationException' => 'ConsoleTools/exceptions/option_mandatory_violation.php', + 'ezcConsoleOptionTypeViolationException' => 'ConsoleTools/exceptions/option_type_violation.php', + 'ezcConsoleOptionMissingValueException' => 'ConsoleTools/exceptions/option_missing_value.php', + 'ezcConsoleOptionNotExistsException' => 'ConsoleTools/exceptions/option_not_exists.php', + 'ezcConsoleOptionTooManyValuesException' => 'ConsoleTools/exceptions/option_too_many_values.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/db_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/db_autoload.php index b55435ee5b3733ef68a4d0e7a810d67d01159a26..b6334e4cc2365bac9b6688af96a23aa6148664d2 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/db_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/db_autoload.php @@ -1,30 +1,29 @@ - 'Database/factory.php', - 'ezcDbInstance' => 'Database/instance.php', - 'ezcDbException' => 'Database/exceptions/exception.php', - 'ezcDbHandlerNotFoundException' => 'Database/exceptions/handler_not_found.php', - 'ezcDbTransactionException' => 'Database/exceptions/transaction.php', - 'ezcDbMissingParameterException' => 'Database/exceptions/missing_parameter.php', - 'ezcDbHandler' => 'Database/handler.php', - 'ezcDbHandlerMysql' => 'Database/handlers/mysql.php', - 'ezcDbHandlerOracle' => 'Database/handlers/oracle.php', - 'ezcDbHandlerPgsql' => 'Database/handlers/pgsql.php', - 'ezcDbHandlerSqlite' => 'Database/handlers/sqlite.php', - 'ezcDbUtilities' => 'Database/sqlabstraction/utilities.php', - 'ezcDbUtilitiesMysql' => 'Database/sqlabstraction/implementations/utilities_mysql.php', - 'ezcDbUtilitiesOracle' => 'Database/sqlabstraction/implementations/utilities_oracle.php', - 'ezcDbUtilitiesPgsql' => 'Database/sqlabstraction/implementations/utilities_pgsql.php', - 'ezcDbUtilitiesSqlite' => 'Database/sqlabstraction/implementations/utilities_sqlite.php', -); -?> + 'Database/factory.php', + 'ezcDbInstance' => 'Database/instance.php', + 'ezcDbException' => 'Database/exceptions/exception.php', + 'ezcDbHandlerNotFoundException' => 'Database/exceptions/handler_not_found.php', + 'ezcDbTransactionException' => 'Database/exceptions/transaction.php', + 'ezcDbMissingParameterException' => 'Database/exceptions/missing_parameter.php', + 'ezcDbHandler' => 'Database/handler.php', + 'ezcDbHandlerMysql' => 'Database/handlers/mysql.php', + 'ezcDbHandlerOracle' => 'Database/handlers/oracle.php', + 'ezcDbHandlerPgsql' => 'Database/handlers/pgsql.php', + 'ezcDbHandlerSqlite' => 'Database/handlers/sqlite.php', + 'ezcDbUtilities' => 'Database/sqlabstraction/utilities.php', + 'ezcDbUtilitiesMysql' => 'Database/sqlabstraction/implementations/utilities_mysql.php', + 'ezcDbUtilitiesOracle' => 'Database/sqlabstraction/implementations/utilities_oracle.php', + 'ezcDbUtilitiesPgsql' => 'Database/sqlabstraction/implementations/utilities_pgsql.php', + 'ezcDbUtilitiesSqlite' => 'Database/sqlabstraction/implementations/utilities_sqlite.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/db_schema_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/db_schema_autoload.php index de2910b655514b0a8d19b906bf60b4bafd55dfa4..b7f630d4f174354cd451ac98f9c2d33584dc86b9 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/db_schema_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/db_schema_autoload.php @@ -1,60 +1,59 @@ - 'DatabaseSchema/schema.php', - 'ezcDbSchemaDiff' => 'DatabaseSchema/schema_diff.php', - 'ezcDbSchemaHandlerManager' => 'DatabaseSchema/handler_manager.php', - - 'ezcDbSchemaValidator' => 'DatabaseSchema/validator.php', - 'ezcDbSchemaTypesValidator' => 'DatabaseSchema/validators/types.php', - 'ezcDbSchemaIndexFieldsValidator' => 'DatabaseSchema/validators/index_fields.php', - 'ezcDbSchemaAutoIncrementIndexValidator' => 'DatabaseSchema/validators/auto_increment_index.php', - - 'ezcDbSchemaComparator' => 'DatabaseSchema/comparator.php', - 'ezcDbSchemaTableDiff' => 'DatabaseSchema/structs/table_diff.php', - - 'ezcDbSchemaReader' => 'DatabaseSchema/interfaces/schema_reader.php', - 'ezcDbSchemaWriter' => 'DatabaseSchema/interfaces/schema_writer.php', - 'ezcDbSchemaDbReader' => 'DatabaseSchema/interfaces/db_reader.php', - 'ezcDbSchemaDbWriter' => 'DatabaseSchema/interfaces/db_writer.php', - 'ezcDbSchemaFileReader' => 'DatabaseSchema/interfaces/file_reader.php', - 'ezcDbSchemaFileWriter' => 'DatabaseSchema/interfaces/file_writer.php', - - 'ezcDbSchemaDiffReader' => 'DatabaseSchema/interfaces/schema_diff_reader.php', - 'ezcDbSchemaDiffWriter' => 'DatabaseSchema/interfaces/schema_diff_writer.php', - 'ezcDbSchemaDiffDbWriter' => 'DatabaseSchema/interfaces/db_diff_writer.php', - 'ezcDbSchemaDiffFileReader' => 'DatabaseSchema/interfaces/file_diff_reader.php', - 'ezcDbSchemaDiffFileWriter' => 'DatabaseSchema/interfaces/file_diff_writer.php', - - 'ezcDbSchemaCommonSqlWriter' => 'DatabaseSchema/handlers/common_sql_writer.php', - 'ezcDbSchemaPhpArrayReader' => 'DatabaseSchema/handlers/php_array/reader.php', - 'ezcDbSchemaPhpArrayWriter' => 'DatabaseSchema/handlers/php_array/writer.php', - 'ezcDbSchemaXmlReader' => 'DatabaseSchema/handlers/xml/reader.php', - 'ezcDbSchemaXmlWriter' => 'DatabaseSchema/handlers/xml/writer.php', - 'XMLWriter' => 'DatabaseSchema/handlers/xml/xmlwritersubstitute.php', - 'ezcDbSchemaPersistentWriter' => 'DatabaseSchema/handlers/persistent/writer.php', - 'ezcDbSchemaMysqlReader' => 'DatabaseSchema/handlers/mysql/reader.php', - 'ezcDbSchemaMysqlWriter' => 'DatabaseSchema/handlers/mysql/writer.php', - - 'ezcDbSchemaTable' => 'DatabaseSchema/structs/table.php', - 'ezcDbSchemaField' => 'DatabaseSchema/structs/field.php', - 'ezcDbSchemaIndex' => 'DatabaseSchema/structs/index.php', - 'ezcDbSchemaIndexField' => 'DatabaseSchema/structs/index_field.php', - - 'ezcDbSchemaException' => 'DatabaseSchema/exceptions/exception.php', - 'ezcDbSchemaInvalidSchemaException' => 'DatabaseSchema/exceptions/invalid_schema.php', - 'ezcDbSchemaUnknownFormatException' => 'DatabaseSchema/exceptions/unknown_format.php', - 'ezcDbSchemaInvalidReaderClassException' => 'DatabaseSchema/exceptions/invalid_reader_class.php', - 'ezcDbSchemaInvalidWriterClassException' => 'DatabaseSchema/exceptions/invalid_writer_class.php', - 'ezcDbSchemaInvalidDiffReaderClassException' => 'DatabaseSchema/exceptions/invalid_diff_reader_class.php', - 'ezcDbSchemaInvalidDiffWriterClassException' => 'DatabaseSchema/exceptions/invalid_diff_writer_class.php', -); -?> + 'DatabaseSchema/schema.php', + 'ezcDbSchemaDiff' => 'DatabaseSchema/schema_diff.php', + 'ezcDbSchemaHandlerManager' => 'DatabaseSchema/handler_manager.php', + + 'ezcDbSchemaValidator' => 'DatabaseSchema/validator.php', + 'ezcDbSchemaTypesValidator' => 'DatabaseSchema/validators/types.php', + 'ezcDbSchemaIndexFieldsValidator' => 'DatabaseSchema/validators/index_fields.php', + 'ezcDbSchemaAutoIncrementIndexValidator' => 'DatabaseSchema/validators/auto_increment_index.php', + + 'ezcDbSchemaComparator' => 'DatabaseSchema/comparator.php', + 'ezcDbSchemaTableDiff' => 'DatabaseSchema/structs/table_diff.php', + + 'ezcDbSchemaReader' => 'DatabaseSchema/interfaces/schema_reader.php', + 'ezcDbSchemaWriter' => 'DatabaseSchema/interfaces/schema_writer.php', + 'ezcDbSchemaDbReader' => 'DatabaseSchema/interfaces/db_reader.php', + 'ezcDbSchemaDbWriter' => 'DatabaseSchema/interfaces/db_writer.php', + 'ezcDbSchemaFileReader' => 'DatabaseSchema/interfaces/file_reader.php', + 'ezcDbSchemaFileWriter' => 'DatabaseSchema/interfaces/file_writer.php', + + 'ezcDbSchemaDiffReader' => 'DatabaseSchema/interfaces/schema_diff_reader.php', + 'ezcDbSchemaDiffWriter' => 'DatabaseSchema/interfaces/schema_diff_writer.php', + 'ezcDbSchemaDiffDbWriter' => 'DatabaseSchema/interfaces/db_diff_writer.php', + 'ezcDbSchemaDiffFileReader' => 'DatabaseSchema/interfaces/file_diff_reader.php', + 'ezcDbSchemaDiffFileWriter' => 'DatabaseSchema/interfaces/file_diff_writer.php', + + 'ezcDbSchemaCommonSqlWriter' => 'DatabaseSchema/handlers/common_sql_writer.php', + 'ezcDbSchemaPhpArrayReader' => 'DatabaseSchema/handlers/php_array/reader.php', + 'ezcDbSchemaPhpArrayWriter' => 'DatabaseSchema/handlers/php_array/writer.php', + 'ezcDbSchemaXmlReader' => 'DatabaseSchema/handlers/xml/reader.php', + 'ezcDbSchemaXmlWriter' => 'DatabaseSchema/handlers/xml/writer.php', + 'XMLWriter' => 'DatabaseSchema/handlers/xml/xmlwritersubstitute.php', + 'ezcDbSchemaPersistentWriter' => 'DatabaseSchema/handlers/persistent/writer.php', + 'ezcDbSchemaMysqlReader' => 'DatabaseSchema/handlers/mysql/reader.php', + 'ezcDbSchemaMysqlWriter' => 'DatabaseSchema/handlers/mysql/writer.php', + + 'ezcDbSchemaTable' => 'DatabaseSchema/structs/table.php', + 'ezcDbSchemaField' => 'DatabaseSchema/structs/field.php', + 'ezcDbSchemaIndex' => 'DatabaseSchema/structs/index.php', + 'ezcDbSchemaIndexField' => 'DatabaseSchema/structs/index_field.php', + + 'ezcDbSchemaException' => 'DatabaseSchema/exceptions/exception.php', + 'ezcDbSchemaInvalidSchemaException' => 'DatabaseSchema/exceptions/invalid_schema.php', + 'ezcDbSchemaUnknownFormatException' => 'DatabaseSchema/exceptions/unknown_format.php', + 'ezcDbSchemaInvalidReaderClassException' => 'DatabaseSchema/exceptions/invalid_reader_class.php', + 'ezcDbSchemaInvalidWriterClassException' => 'DatabaseSchema/exceptions/invalid_writer_class.php', + 'ezcDbSchemaInvalidDiffReaderClassException' => 'DatabaseSchema/exceptions/invalid_diff_reader_class.php', + 'ezcDbSchemaInvalidDiffWriterClassException' => 'DatabaseSchema/exceptions/invalid_diff_writer_class.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/debug_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/debug_autoload.php index 5d7f562102bfcb9c0c4b2a90a8bd904fc39e3d0c..2d0d509b2409a88f04e4668ddfc6fdf6b6edf332 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/debug_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/debug_autoload.php @@ -1,26 +1,24 @@ - 'Debug/debug.php', - 'ezcDebugMemoryWriter' => 'Debug/writers/memory_writer.php', - 'ezcDebugStructure' => 'Debug/structs/debug_structure.php', - 'ezcDebugTimer' => 'Debug/debug_timer.php', - - 'ezcDebugOutputFormatter' => 'Debug/interfaces/formatter.php', - 'ezcDebugHtmlFormatter' => 'Debug/formatters/html_formatter.php', - - 'ezcDebugTimerStruct' => 'Debug/structs/timer.php', - 'ezcDebugSwitchTimerStruct' => 'Debug/structs/switch_timer.php', - - 'ezcDebugMessage' => 'Debug/debug_message.php' -); - -?> + 'Debug/debug.php', + 'ezcDebugMemoryWriter' => 'Debug/writers/memory_writer.php', + 'ezcDebugStructure' => 'Debug/structs/debug_structure.php', + 'ezcDebugTimer' => 'Debug/debug_timer.php', + + 'ezcDebugOutputFormatter' => 'Debug/interfaces/formatter.php', + 'ezcDebugHtmlFormatter' => 'Debug/formatters/html_formatter.php', + + 'ezcDebugTimerStruct' => 'Debug/structs/timer.php', + 'ezcDebugSwitchTimerStruct' => 'Debug/structs/switch_timer.php', + + 'ezcDebugMessage' => 'Debug/debug_message.php' +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/execution_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/execution_autoload.php index 43e9fae1273442945270e692a9f0805a0d704059..5661e6c60d9397b19b1d390a3258327923d639ab 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/execution_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/execution_autoload.php @@ -1,24 +1,22 @@ - 'Execution/execution.php', - 'ezcExecutionErrorHandler' => 'Execution/interfaces/execution_handler.php', - 'ezcExecutionBasicErrorHandler' => 'Execution/handlers/basic_handler.php', - - 'ezcExecutionException' => 'Execution/exceptions/exception.php', - 'ezcExecutionAlreadyInitializedException' => 'Execution/exceptions/already_initialized.php', - 'ezcExecutionInvalidCallbackException' => 'Execution/exceptions/invalid_callback.php', - 'ezcExecutionNotInitializedException' => 'Execution/exceptions/not_initialized.php', - 'ezcExecutionWrongClassException' => 'Execution/exceptions/wrong_class.php', -); - -?> + 'Execution/execution.php', + 'ezcExecutionErrorHandler' => 'Execution/interfaces/execution_handler.php', + 'ezcExecutionBasicErrorHandler' => 'Execution/handlers/basic_handler.php', + + 'ezcExecutionException' => 'Execution/exceptions/exception.php', + 'ezcExecutionAlreadyInitializedException' => 'Execution/exceptions/already_initialized.php', + 'ezcExecutionInvalidCallbackException' => 'Execution/exceptions/invalid_callback.php', + 'ezcExecutionNotInitializedException' => 'Execution/exceptions/not_initialized.php', + 'ezcExecutionWrongClassException' => 'Execution/exceptions/wrong_class.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/file_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/file_autoload.php index b31fc9915c5aa9650f547fd08cfaf0c2d534e472..70e9f76161179e95886fd33a4411653e8cf55aef 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/file_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/file_autoload.php @@ -1,16 +1,14 @@ - 'File/file.php', -); - -?> + 'File/file.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/image_analyzer_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/image_analyzer_autoload.php index ec63a3f59fe16942a18d3c17d8ba716f01f8af0f..710cf94d55307e1f4caaba21134c78dc9ac7512d 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/image_analyzer_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/image_analyzer_autoload.php @@ -1,24 +1,22 @@ - 'ImageAnalysis/analyzer.php', - 'ezcImageAnalyzerData' => 'ImageAnalysis/structs/analyzer_data.php', - 'ezcImageAnalyzerHandler' => 'ImageAnalysis/interfaces/handler.php', - 'ezcImageAnalyzerPhpHandler' => 'ImageAnalysis/handlers/php.php', - 'ezcImageAnalyzerImagemagickHandler' => 'ImageAnalysis/handlers/imagemagick.php', - - 'ezcImageAnalyzerException' => 'ImageAnalysis/exceptions/exception.php', - 'ezcImageAnalyzerFileNotProcessableException' => 'ImageAnalysis/exceptions/file_not_processable.php', - 'ezcImageAnalyzerInvalidHandlerException' => 'ImageAnalysis/exceptions/invalid_handler.php', -); - -?> + 'ImageAnalysis/analyzer.php', + 'ezcImageAnalyzerData' => 'ImageAnalysis/structs/analyzer_data.php', + 'ezcImageAnalyzerHandler' => 'ImageAnalysis/interfaces/handler.php', + 'ezcImageAnalyzerPhpHandler' => 'ImageAnalysis/handlers/php.php', + 'ezcImageAnalyzerImagemagickHandler' => 'ImageAnalysis/handlers/imagemagick.php', + + 'ezcImageAnalyzerException' => 'ImageAnalysis/exceptions/exception.php', + 'ezcImageAnalyzerFileNotProcessableException' => 'ImageAnalysis/exceptions/file_not_processable.php', + 'ezcImageAnalyzerInvalidHandlerException' => 'ImageAnalysis/exceptions/invalid_handler.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/image_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/image_autoload.php index 0db68057cc1227998da1b27241bcdc9abf216597..3c6f768243b4276a1f73d9157d47a1c6ee781d36 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/image_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/image_autoload.php @@ -1,50 +1,48 @@ - 'ImageConversion/converter.php', - 'ezcImageConverterSettings' => 'ImageConversion/structs/converter_settings.php', - - 'ezcImageTransformation' => 'ImageConversion/transformation.php', - - 'ezcImageHandler' => 'ImageConversion/interfaces/handler.php', - 'ezcImageHandlerSettings' => 'ImageConversion/structs/handler_settings.php', - 'ezcImageMethodcallHandler' => 'ImageConversion/interfaces/methodcall_handler.php', - - 'ezcImageFilter' => 'ImageConversion/structs/filter.php', - - 'ezcImageGeometryFilters' => 'ImageConversion/interfaces/geometry.php', - 'ezcImageColorspaceFilters' => 'ImageConversion/interfaces/colorspace.php', - 'ezcImageEffectFilters' => 'ImageConversion/interfaces/effect.php', - - 'ezcImageGdHandler' => 'ImageConversion/handlers/gd.php', - 'ezcImageGdBaseHandler' => 'ImageConversion/handlers/gd_base.php', - - 'ezcImageImagemagickHandler' => 'ImageConversion/handlers/imagemagick.php', - 'ezcImageImagemagickBaseHandler' => 'ImageConversion/handlers/imagemagick_base.php', - - 'ezcImageException' => 'ImageConversion/exceptions/exception.php', - 'ezcImageMissingFilterParameterException' => 'ImageConversion/exceptions/missing_filter_parameter.php', - 'ezcImageFileNotProcessableException' => 'ImageConversion/exceptions/file_not_processable.php', - 'ezcImageFileNameInvalidException' => 'ImageConversion/exceptions/file_name_invalid.php', - 'ezcImageFilterFailedException' => 'ImageConversion/exceptions/filter_failed.php', - 'ezcImageFilterNotAvailableException' => 'ImageConversion/exceptions/filter_not_available.php', - 'ezcImageHandlerNotAvailableException' => 'ImageConversion/exceptions/handler_not_available.php', - 'ezcImageHandlerSettingsInvalidException' => 'ImageConversion/exceptions/handler_settings_invalid.php', - 'ezcImageInvalidFilterParameterException' => 'ImageConversion/exceptions/invalid_filter_parameter.php', - 'ezcImageInvalidReferenceException' => 'ImageConversion/exceptions/invalid_reference.php', - 'ezcImageMimeTypeUnsupportedException' => 'ImageConversion/exceptions/mime_type_unsupported.php', - 'ezcImageTransformationException' => 'ImageConversion/exceptions/transformation.php', - 'ezcImageTransformationAlreadyExistsException' => 'ImageConversion/exceptions/transformation_already_exists.php', - 'ezcImageTransformationNotAvailableException' => 'ImageConversion/exceptions/transformation_not_available.php', -); - -?> + 'ImageConversion/converter.php', + 'ezcImageConverterSettings' => 'ImageConversion/structs/converter_settings.php', + + 'ezcImageTransformation' => 'ImageConversion/transformation.php', + + 'ezcImageHandler' => 'ImageConversion/interfaces/handler.php', + 'ezcImageHandlerSettings' => 'ImageConversion/structs/handler_settings.php', + 'ezcImageMethodcallHandler' => 'ImageConversion/interfaces/methodcall_handler.php', + + 'ezcImageFilter' => 'ImageConversion/structs/filter.php', + + 'ezcImageGeometryFilters' => 'ImageConversion/interfaces/geometry.php', + 'ezcImageColorspaceFilters' => 'ImageConversion/interfaces/colorspace.php', + 'ezcImageEffectFilters' => 'ImageConversion/interfaces/effect.php', + + 'ezcImageGdHandler' => 'ImageConversion/handlers/gd.php', + 'ezcImageGdBaseHandler' => 'ImageConversion/handlers/gd_base.php', + + 'ezcImageImagemagickHandler' => 'ImageConversion/handlers/imagemagick.php', + 'ezcImageImagemagickBaseHandler' => 'ImageConversion/handlers/imagemagick_base.php', + + 'ezcImageException' => 'ImageConversion/exceptions/exception.php', + 'ezcImageMissingFilterParameterException' => 'ImageConversion/exceptions/missing_filter_parameter.php', + 'ezcImageFileNotProcessableException' => 'ImageConversion/exceptions/file_not_processable.php', + 'ezcImageFileNameInvalidException' => 'ImageConversion/exceptions/file_name_invalid.php', + 'ezcImageFilterFailedException' => 'ImageConversion/exceptions/filter_failed.php', + 'ezcImageFilterNotAvailableException' => 'ImageConversion/exceptions/filter_not_available.php', + 'ezcImageHandlerNotAvailableException' => 'ImageConversion/exceptions/handler_not_available.php', + 'ezcImageHandlerSettingsInvalidException' => 'ImageConversion/exceptions/handler_settings_invalid.php', + 'ezcImageInvalidFilterParameterException' => 'ImageConversion/exceptions/invalid_filter_parameter.php', + 'ezcImageInvalidReferenceException' => 'ImageConversion/exceptions/invalid_reference.php', + 'ezcImageMimeTypeUnsupportedException' => 'ImageConversion/exceptions/mime_type_unsupported.php', + 'ezcImageTransformationException' => 'ImageConversion/exceptions/transformation.php', + 'ezcImageTransformationAlreadyExistsException' => 'ImageConversion/exceptions/transformation_already_exists.php', + 'ezcImageTransformationNotAvailableException' => 'ImageConversion/exceptions/transformation_not_available.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/input_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/input_autoload.php index 962490ac5a0c3569709fb08d368a71da3203e349..e394bbb4d5288c701e89d7d2c44a2ffc159131f0 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/input_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/input_autoload.php @@ -1,29 +1,27 @@ - 'UserInput/input_form.php', - 'ezcInputFormDefinitionElement' => 'UserInput/structs/definition_element.php', - 'ezcInputFilter' => 'UserInput/input_filter.php', - - 'ezcInputFormException' => 'UserInput/exceptions/exception.php', - 'ezcInputFormFieldNotFoundException' => 'UserInput/exceptions/field_not_found.php', - 'ezcInputFormInvalidDefinitionException' => 'UserInput/exceptions/invalid_definition.php', - 'ezcInputFormNoValidDataException' => 'UserInput/exceptions/no_valid_data.php', - 'ezcInputFormUnknownFieldException' => 'UserInput/exceptions/unknown_field.php', - 'ezcInputFormValidDataAvailableException' => 'UserInput/exceptions/valid_data_available.php', - 'ezcInputFormVariableMissingException' => 'UserInput/exceptions/input_variable_missing.php', - 'ezcInputFormWrongInputSourceException' => 'UserInput/exceptions/wrong_input_source.php', -); - -?> + 'UserInput/input_form.php', + 'ezcInputFormDefinitionElement' => 'UserInput/structs/definition_element.php', + 'ezcInputFilter' => 'UserInput/input_filter.php', + + 'ezcInputFormException' => 'UserInput/exceptions/exception.php', + 'ezcInputFormFieldNotFoundException' => 'UserInput/exceptions/field_not_found.php', + 'ezcInputFormInvalidDefinitionException' => 'UserInput/exceptions/invalid_definition.php', + 'ezcInputFormNoValidDataException' => 'UserInput/exceptions/no_valid_data.php', + 'ezcInputFormUnknownFieldException' => 'UserInput/exceptions/unknown_field.php', + 'ezcInputFormValidDataAvailableException' => 'UserInput/exceptions/valid_data_available.php', + 'ezcInputFormVariableMissingException' => 'UserInput/exceptions/input_variable_missing.php', + 'ezcInputFormWrongInputSourceException' => 'UserInput/exceptions/wrong_input_source.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/log_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/log_autoload.php index 0aee484c01af2863dae186c35afca4552db58da0..a5a115a39260fb72b249a46584502399593a9a6a 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/log_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/log_autoload.php @@ -1,31 +1,30 @@ - 'EventLog/log.php', - - 'ezcLogContext' => 'EventLog/context.php', - 'ezcLogMessage' => 'EventLog/log_message.php', - - 'ezcLogWriter' => 'EventLog/interfaces/writer.php', - 'ezcLogMapper' => 'EventLog/interfaces/mapper.php', - - 'ezcLogFilter' => 'EventLog/structs/log_filter.php', - - 'ezcLogFilterSet' => 'EventLog/mapper/filterset.php', - 'ezcLogFilterRule' => 'EventLog/mapper/filter_rule.php', - - 'ezcLogFileWriter' => 'EventLog/writers/writer_file.php', - 'ezcLogUnixFileWriter' => 'EventLog/writers/writer_unix_file.php', - - 'ezcLogWriterException'=> 'EventLog/exceptions/writer_exception.php' -); -?> + 'EventLog/log.php', + + 'ezcLogContext' => 'EventLog/context.php', + 'ezcLogMessage' => 'EventLog/log_message.php', + + 'ezcLogWriter' => 'EventLog/interfaces/writer.php', + 'ezcLogMapper' => 'EventLog/interfaces/mapper.php', + + 'ezcLogFilter' => 'EventLog/structs/log_filter.php', + + 'ezcLogFilterSet' => 'EventLog/mapper/filterset.php', + 'ezcLogFilterRule' => 'EventLog/mapper/filter_rule.php', + + 'ezcLogFileWriter' => 'EventLog/writers/writer_file.php', + 'ezcLogUnixFileWriter' => 'EventLog/writers/writer_unix_file.php', + + 'ezcLogWriterException'=> 'EventLog/exceptions/writer_exception.php' +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/log_database_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/log_database_autoload.php index 880fc3dd02ce810e41233234622cce7d04c38f5e..6e253fd1ea8116556e33fbcbb9644ca560f1a65e 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/log_database_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/log_database_autoload.php @@ -1,15 +1,14 @@ - 'EventLogDatabaseTiein/writers/writer_database.php', -); -?> + 'EventLogDatabaseTiein/writers/writer_database.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/mail_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/mail_autoload.php index 2edebcb09af266fdab30b9155f0c35e8a467e452..235eeebdb0c8233ae41bc20849d2a5ff50553663 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/mail_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/mail_autoload.php @@ -1,62 +1,61 @@ - 'Mail/structs/mail_address.php', - 'ezcMailContentDispositionHeader'=> 'Mail/structs/content_disposition_header.php', - 'ezcMailPart' => 'Mail/interfaces/part.php', - 'ezcMailTransport' => 'Mail/interfaces/transport.php', - 'ezcMail' => 'Mail/mail.php', - 'ezcMailComposer' => 'Mail/composer.php', - 'ezcMailFile' => 'Mail/parts/file.php', - 'ezcMailRfc822Digest' => 'Mail/parts/rfc822_digest.php', - 'ezcMailText' => 'Mail/parts/text.php', - 'ezcMailMultipart' => 'Mail/parts/multipart.php', - 'ezcMailMultipartAlternative' => 'Mail/parts/multiparts/multipart_alternative.php', - 'ezcMailMultipartMixed' => 'Mail/parts/multiparts/multipart_mixed.php', - 'ezcMailMultipartRelated' => 'Mail/parts/multiparts/multipart_related.php', - 'ezcMailMultipartDigest' => 'Mail/parts/multiparts/multipart_digest.php', - 'ezcMailTransportMta' => 'Mail/transports/transport_mta.php', - 'ezcMailTransportSmtp' => 'Mail/transports/transport_smtp.php', - 'ezcMailMtaTransport' => 'Mail/transports/transport_mta.php', - 'ezcMailSmtpTransport' => 'Mail/transports/transport_smtp.php', - 'ezcMailTransportConnection' => 'Mail/transports/transport_connection.php', - 'ezcMailPop3Transport' => 'Mail/transports/pop3/pop3_transport.php', - 'ezcMailPop3Set' => 'Mail/transports/pop3/pop3_set.php', - 'ezcMailMboxTransport' => 'Mail/transports/mbox/mbox_transport.php', - 'ezcMailMboxSet' => 'Mail/transports/mbox/mbox_set.php', - 'ezcMailFileSet' => 'Mail/transports/file/file_set.php', - 'ezcMailVariableSet' => 'Mail/transports/variable/var_set.php', - - 'ezcMailException' => 'Mail/exceptions/mail_exception.php', - 'ezcMailTransportException' => 'Mail/exceptions/transport_exception.php', - 'ezcMailTransportSmtpException' => 'Mail/exceptions/transport_smtp_exception.php', - 'ezcMailNoSuchMessageException' => 'Mail/exceptions/no_such_message.php', - - 'ezcMailTools' => 'Mail/tools.php', - 'ezcMailParser' => 'Mail/parser/parser.php', - 'ezcMailPartParser' => 'Mail/parser/interfaces/part_parser.php', - 'ezcMailRfc822Parser' => 'Mail/parser/parts/rfc822_parser.php', - 'ezcMailTextParser' => 'Mail/parser/parts/text_parser.php', - 'ezcMailMultipartParser' => 'Mail/parser/parts/multipart_parser.php', - 'ezcMailMultipartMixedParser' => 'Mail/parser/parts/multipart_mixed_parser.php', - 'ezcMailMultipartDigestParser' => 'Mail/parser/parts/multipart_digest_parser.php', - 'ezcMailMultipartAlternativeParser' => 'Mail/parser/parts/multipart_alternative_parser.php', - 'ezcMailMultipartRelatedParser' => 'Mail/parser/parts/multipart_related_parser.php', - 'ezcMailFileParser' => 'Mail/parser/parts/file_parser.php', - 'ezcMailRfc822DigestParser' => 'Mail/parser/parts/rfc822_digest_parser.php', - 'ezcMailHeadersHolder' => 'Mail/parser/headers_holder.php', - 'ezcMailParserSet' => 'Mail/parser/interfaces/parser_set.php', - 'ezcMailParserShutdownHandler' => 'Mail/parser/shutdown_handler.php', - 'ezcMailRfc2231Implementation' => 'Mail/parser/rfc2231_implementation.php', - - 'ezcMailCharsetConverter' => 'Mail/internal/charset_convert.php', - 'ezcMailHeaderFolder' => 'Mail/internal/header_folder.php' - ); -?> + 'Mail/structs/mail_address.php', + 'ezcMailContentDispositionHeader'=> 'Mail/structs/content_disposition_header.php', + 'ezcMailPart' => 'Mail/interfaces/part.php', + 'ezcMailTransport' => 'Mail/interfaces/transport.php', + 'ezcMail' => 'Mail/mail.php', + 'ezcMailComposer' => 'Mail/composer.php', + 'ezcMailFile' => 'Mail/parts/file.php', + 'ezcMailRfc822Digest' => 'Mail/parts/rfc822_digest.php', + 'ezcMailText' => 'Mail/parts/text.php', + 'ezcMailMultipart' => 'Mail/parts/multipart.php', + 'ezcMailMultipartAlternative' => 'Mail/parts/multiparts/multipart_alternative.php', + 'ezcMailMultipartMixed' => 'Mail/parts/multiparts/multipart_mixed.php', + 'ezcMailMultipartRelated' => 'Mail/parts/multiparts/multipart_related.php', + 'ezcMailMultipartDigest' => 'Mail/parts/multiparts/multipart_digest.php', + 'ezcMailTransportMta' => 'Mail/transports/transport_mta.php', + 'ezcMailTransportSmtp' => 'Mail/transports/transport_smtp.php', + 'ezcMailMtaTransport' => 'Mail/transports/transport_mta.php', + 'ezcMailSmtpTransport' => 'Mail/transports/transport_smtp.php', + 'ezcMailTransportConnection' => 'Mail/transports/transport_connection.php', + 'ezcMailPop3Transport' => 'Mail/transports/pop3/pop3_transport.php', + 'ezcMailPop3Set' => 'Mail/transports/pop3/pop3_set.php', + 'ezcMailMboxTransport' => 'Mail/transports/mbox/mbox_transport.php', + 'ezcMailMboxSet' => 'Mail/transports/mbox/mbox_set.php', + 'ezcMailFileSet' => 'Mail/transports/file/file_set.php', + 'ezcMailVariableSet' => 'Mail/transports/variable/var_set.php', + + 'ezcMailException' => 'Mail/exceptions/mail_exception.php', + 'ezcMailTransportException' => 'Mail/exceptions/transport_exception.php', + 'ezcMailTransportSmtpException' => 'Mail/exceptions/transport_smtp_exception.php', + 'ezcMailNoSuchMessageException' => 'Mail/exceptions/no_such_message.php', + + 'ezcMailTools' => 'Mail/tools.php', + 'ezcMailParser' => 'Mail/parser/parser.php', + 'ezcMailPartParser' => 'Mail/parser/interfaces/part_parser.php', + 'ezcMailRfc822Parser' => 'Mail/parser/parts/rfc822_parser.php', + 'ezcMailTextParser' => 'Mail/parser/parts/text_parser.php', + 'ezcMailMultipartParser' => 'Mail/parser/parts/multipart_parser.php', + 'ezcMailMultipartMixedParser' => 'Mail/parser/parts/multipart_mixed_parser.php', + 'ezcMailMultipartDigestParser' => 'Mail/parser/parts/multipart_digest_parser.php', + 'ezcMailMultipartAlternativeParser' => 'Mail/parser/parts/multipart_alternative_parser.php', + 'ezcMailMultipartRelatedParser' => 'Mail/parser/parts/multipart_related_parser.php', + 'ezcMailFileParser' => 'Mail/parser/parts/file_parser.php', + 'ezcMailRfc822DigestParser' => 'Mail/parser/parts/rfc822_digest_parser.php', + 'ezcMailHeadersHolder' => 'Mail/parser/headers_holder.php', + 'ezcMailParserSet' => 'Mail/parser/interfaces/parser_set.php', + 'ezcMailParserShutdownHandler' => 'Mail/parser/shutdown_handler.php', + 'ezcMailRfc2231Implementation' => 'Mail/parser/rfc2231_implementation.php', + + 'ezcMailCharsetConverter' => 'Mail/internal/charset_convert.php', + 'ezcMailHeaderFolder' => 'Mail/internal/header_folder.php' + ); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/persistent_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/persistent_autoload.php index 15058827d008a50390b401a42f360ccee872a5b4..f0f0b05ad712cce44052c3df67abf41033ecb3db 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/persistent_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/persistent_autoload.php @@ -1,28 +1,27 @@ - 'PersistentObject/structs/persistent_object_definition.php', - 'ezcPersistentObjectProperty' => 'PersistentObject/structs/persistent_object_property.php', - 'ezcPersistentObjectIdProperty' => 'PersistentObject/structs/persistent_object_id_property.php', - 'ezcPersistentDefinitionManager' => 'PersistentObject/interfaces/definition_manager.php', - 'ezcPersistentCodeManager' => 'PersistentObject/managers/code_manager.php', - 'ezcPersistentSession' => 'PersistentObject/persistent_session.php', - 'ezcPersistentObjectException' => 'PersistentObject/exceptions/persistent_object_exception.php', - 'ezcPersistentDefinitionNotFoundException' => 'PersistentObject/exceptions/definition_not_found.php', - 'ezcPersistentObjectNotPersistentException' => 'PersistentObject/exceptions/not_persistent.php', - 'ezcPersistentObjectAlreadyPersistentException' => 'PersistentObject/exceptions/already_persistent.php', - 'ezcPersistentQueryException' => 'PersistentObject/exceptions/query_exception.php', - 'ezcPersistentIdentifierGenerationException' => 'PersistentObject/exceptions/identifier_generation.php', - 'ezcPersistentFindIterator' => 'PersistentObject/find_iterator.php', - 'ezcPersistentStateTransformer' => 'PersistentObject/internal/state_transformer.php', - 'ezcPersistentSequenceGenerator' => 'PersistentObject/generators/sequence_generator.php', - 'ezcPersistentIdentifierGenerator' => 'PersistentObject/interfaces/identifier_generator.php', - 'ezcPersistentManualGenerator' => 'PersistentObject/generators/manual_generator.php', - 'ezcPersistentGeneratorDefinition' => 'PersistentObject/structs/generator_definition.php' ); -?> + 'PersistentObject/structs/persistent_object_definition.php', + 'ezcPersistentObjectProperty' => 'PersistentObject/structs/persistent_object_property.php', + 'ezcPersistentObjectIdProperty' => 'PersistentObject/structs/persistent_object_id_property.php', + 'ezcPersistentDefinitionManager' => 'PersistentObject/interfaces/definition_manager.php', + 'ezcPersistentCodeManager' => 'PersistentObject/managers/code_manager.php', + 'ezcPersistentSession' => 'PersistentObject/persistent_session.php', + 'ezcPersistentObjectException' => 'PersistentObject/exceptions/persistent_object_exception.php', + 'ezcPersistentDefinitionNotFoundException' => 'PersistentObject/exceptions/definition_not_found.php', + 'ezcPersistentObjectNotPersistentException' => 'PersistentObject/exceptions/not_persistent.php', + 'ezcPersistentObjectAlreadyPersistentException' => 'PersistentObject/exceptions/already_persistent.php', + 'ezcPersistentQueryException' => 'PersistentObject/exceptions/query_exception.php', + 'ezcPersistentIdentifierGenerationException' => 'PersistentObject/exceptions/identifier_generation.php', + 'ezcPersistentFindIterator' => 'PersistentObject/find_iterator.php', + 'ezcPersistentStateTransformer' => 'PersistentObject/internal/state_transformer.php', + 'ezcPersistentSequenceGenerator' => 'PersistentObject/generators/sequence_generator.php', + 'ezcPersistentIdentifierGenerator' => 'PersistentObject/interfaces/identifier_generator.php', + 'ezcPersistentManualGenerator' => 'PersistentObject/generators/manual_generator.php', + 'ezcPersistentGeneratorDefinition' => 'PersistentObject/structs/generator_definition.php' ); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/persistent_object_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/persistent_object_autoload.php index 3902d7ce4615cd6bb79c18ee6782675c7aace1da..1a127cda8f7b85dedd8385e329b98126542c60d2 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/persistent_object_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/persistent_object_autoload.php @@ -1,7 +1,5 @@ - 'PersistentObjectDatabaseSchemaTiein/generator.php', -); - -?> + 'PersistentObjectDatabaseSchemaTiein/generator.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/php_generator_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/php_generator_autoload.php index 493d3993dae46f68e291f2c8a8d336a9833babd6..1786ee396e7864613d32aed7adcc1d5705a1b131 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/php_generator_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/php_generator_autoload.php @@ -1,17 +1,16 @@ - 'PhpGenerator/structs/php_generator_return_data.php', - 'ezcPhpGeneratorParameter' => 'PhpGenerator/structs/php_generator_parameter.php', - 'ezcPhpGenerator' => 'PhpGenerator/php_generator.php', - 'ezcPhpGeneratorException' => 'PhpGenerator/exceptions/php_generator_exception.php', - 'ezcPhpGeneratorFlowException' => 'PhpGenerator/exceptions/flow_exception.php' -); -?> + 'PhpGenerator/structs/php_generator_return_data.php', + 'ezcPhpGeneratorParameter' => 'PhpGenerator/structs/php_generator_parameter.php', + 'ezcPhpGenerator' => 'PhpGenerator/php_generator.php', + 'ezcPhpGeneratorException' => 'PhpGenerator/exceptions/php_generator_exception.php', + 'ezcPhpGeneratorFlowException' => 'PhpGenerator/exceptions/flow_exception.php' +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/query_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/query_autoload.php index 555d135d74788cd36e024e6ab7c60105d928bab1..46fcc5009783214054c808ff5fb2d552f43dfbee 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/query_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/query_autoload.php @@ -1,30 +1,29 @@ - 'Database/sqlabstraction/query.php', - 'ezcQueryException' => 'Database/exceptions/query_exception.php', - 'ezcQueryInvalidException' => 'Database/exceptions/query/invalid.php', - 'ezcQueryVariableParameterException' => 'Database/exceptions/query/variable_parameter.php', - 'ezcQuerySelect' => 'Database/sqlabstraction/query_select.php', - 'ezcQuerySubSelect' => 'Database/sqlabstraction/query_subselect.php', - 'ezcQuerySelectOracle' => 'Database/sqlabstraction/implementations/query_select_oracle.php', - 'ezcQuerySelectSqlite' => 'Database/sqlabstraction/implementations/query_select_sqlite.php', - 'ezcQueryExpression' => 'Database/sqlabstraction/expression.php', - 'ezcQueryExpressionOracle' => 'Database/sqlabstraction/implementations/expression_oracle.php', - 'ezcQueryExpressionPgsql' => 'Database/sqlabstraction/implementations/expression_pgsql.php', - 'ezcQueryExpressionSqlite' => 'Database/sqlabstraction/implementations/expression_sqlite.php', - 'ezcQuerySqliteFunctions' => 'Database/sqlabstraction/implementations/query_sqlite_function_implementations.php', - 'ezcQueryInsert' => 'Database/sqlabstraction/query_insert.php', - 'ezcQueryUpdate' => 'Database/sqlabstraction/query_update.php', - 'ezcQueryDelete' => 'Database/sqlabstraction/query_delete.php', -); -?> + 'Database/sqlabstraction/query.php', + 'ezcQueryException' => 'Database/exceptions/query_exception.php', + 'ezcQueryInvalidException' => 'Database/exceptions/query/invalid.php', + 'ezcQueryVariableParameterException' => 'Database/exceptions/query/variable_parameter.php', + 'ezcQuerySelect' => 'Database/sqlabstraction/query_select.php', + 'ezcQuerySubSelect' => 'Database/sqlabstraction/query_subselect.php', + 'ezcQuerySelectOracle' => 'Database/sqlabstraction/implementations/query_select_oracle.php', + 'ezcQuerySelectSqlite' => 'Database/sqlabstraction/implementations/query_select_sqlite.php', + 'ezcQueryExpression' => 'Database/sqlabstraction/expression.php', + 'ezcQueryExpressionOracle' => 'Database/sqlabstraction/implementations/expression_oracle.php', + 'ezcQueryExpressionPgsql' => 'Database/sqlabstraction/implementations/expression_pgsql.php', + 'ezcQueryExpressionSqlite' => 'Database/sqlabstraction/implementations/expression_sqlite.php', + 'ezcQuerySqliteFunctions' => 'Database/sqlabstraction/implementations/query_sqlite_function_implementations.php', + 'ezcQueryInsert' => 'Database/sqlabstraction/query_insert.php', + 'ezcQueryUpdate' => 'Database/sqlabstraction/query_update.php', + 'ezcQueryDelete' => 'Database/sqlabstraction/query_delete.php', +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/system_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/system_autoload.php index e4bb387e2c0810fae7cfdf591bb05cfcd1cb9a63..10818da1f5b3bbd20f98d8378d82539c3732ddbb 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/system_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/system_autoload.php @@ -1,20 +1,18 @@ - 'SystemInformation/system/info.php', - 'ezcSystemInfoReader' => 'SystemInformation/system/interfaces/info_reader.php', - 'ezcSystemInfoLinuxReader' => 'SystemInformation/system/readers/info_linux.php', - 'ezcSystemInfoFreeBsdReader' => 'SystemInformation/system/readers/info_freebsd.php', - 'ezcSystemInfoWindowsReader' => 'SystemInformation/system/readers/info_windows.php', - 'ezcSystemInfoAccelerator' => 'SystemInformation/system/structs/accelerator_info.php', - 'ezcSystemInfoReaderCantScanOSException' => 'SystemInformation/system/exceptions/cant_scan.php' -); - -?> + 'SystemInformation/system/info.php', + 'ezcSystemInfoReader' => 'SystemInformation/system/interfaces/info_reader.php', + 'ezcSystemInfoLinuxReader' => 'SystemInformation/system/readers/info_linux.php', + 'ezcSystemInfoFreeBsdReader' => 'SystemInformation/system/readers/info_freebsd.php', + 'ezcSystemInfoWindowsReader' => 'SystemInformation/system/readers/info_windows.php', + 'ezcSystemInfoAccelerator' => 'SystemInformation/system/structs/accelerator_info.php', + 'ezcSystemInfoReaderCantScanOSException' => 'SystemInformation/system/exceptions/cant_scan.php' +); diff --git a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/template_autoload.php b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/template_autoload.php index 5c8a53d035520a2baeb085d63401ca1938857840..5f77dc9e056dfad19db1840cd038812c035dd918 100644 --- a/html/typo3conf/ext/ter/resources/ezcomponents/autoload/template_autoload.php +++ b/html/typo3conf/ext/ter/resources/ezcomponents/autoload/template_autoload.php @@ -1,330 +1,327 @@ - "Template/template.php", - "ezcTemplateConfiguration" => "Template/configuration.php", - "ezcTemplateAutoloaderDefinition" => "Template/structs/autoloader_definition.php", - "ezcTemplateVariable" => "Template/variable.php", - "ezcTemplateVariableCollection" => "Template/variable_collection.php", - "ezcTemplateLocation" => "Template/location.php", - - "ezcTemplateParser" => "Template/parser.php", - "ezcTemplateCursor" => "Template/cursor.php", - "ezcTemplateSymbolTable" => "Template/symbol_table.php", - "ezcTemplateCycle" => "Template/cycle.php", - - "ezcTemplateSourceCode" => "Template/source_code.php", - "ezcTemplateCompiledCode" => "Template/compiled_code.php", - "ezcTemplateValidationItem" => "Template/validation_item.php", - "ezcTemplateXhtmlContext" => "Template/contexts/xhtml_context.php", - "ezcTemplateNoContext" => "Template/contexts/no_context.php", - "ezcTemplateDirectResourceLocator" => "Template/locators/direct_resource_locator.php", - -// Global Interfaces: - "ezcTemplateAutoloader" => "Template/interfaces/autoloader.php", - "ezcTemplateOutputContext" => "Template/interfaces/output_context.php", - "ezcTemplateResourceLocator" => "Template/interfaces/resource_locator.php", - - -///////////////////////////////////////////////////////// SYNTAX TREES ////////////////////////////////////////////////////////////////// - -// Syntax trees / TST interfaces - "ezcTemplateTstNode" => "Template/syntax_trees/tst/interfaces/tst_node.php", - "ezcTemplateExpressionTstNode" => "Template/syntax_trees/tst/interfaces/expression_tst.php", - "ezcTemplateOperatorTstNode" => "Template/syntax_trees/tst/interfaces/operator_tst.php", - "ezcTemplateModifyingOperatorTstNode" => "Template/syntax_trees/tst/interfaces/modifying_operator_tst.php", - "ezcTemplateCodeTstNode" => "Template/syntax_trees/tst/interfaces/code_tst.php", - "ezcTemplateTextTstNode" => "Template/syntax_trees/tst/interfaces/text_tst.php", - "ezcTemplateTstNodeVisitor" => "Template/syntax_trees/tst/interfaces/tst_visitor.php", - -// Syntax trees / TST nodes - "ezcTemplateBlockTstNode" => "Template/syntax_trees/tst/nodes/block.php", - "ezcTemplateCustomBlockTstNode" => "Template/syntax_trees/tst/nodes/custom_block.php", - "ezcTemplateProgramTstNode" => "Template/syntax_trees/tst/nodes/program.php", - "ezcTemplateLiteralBlockTstNode" => "Template/syntax_trees/tst/nodes/literal_block.php", - "ezcTemplateEmptyBlockTstNode" => "Template/syntax_trees/tst/nodes/empty_block.php", - "ezcTemplateParenthesisTstNode" => "Template/syntax_trees/tst/nodes/parenthesis.php", - "ezcTemplateOutputBlockTstNode" => "Template/syntax_trees/tst/nodes/output_block.php", - "ezcTemplateModifyingBlockTstNode" => "Template/syntax_trees/tst/nodes/modifying_block.php", - "ezcTemplateLiteralArrayTstNode" => "Template/syntax_trees/tst/nodes/literalarray.php", - "ezcTemplateLiteralTstNode" => "Template/syntax_trees/tst/nodes/literal.php", - "ezcTemplateIntegerTstNode" => "Template/syntax_trees/tst/nodes/integer.php", - "ezcTemplateVariableTstNode" => "Template/syntax_trees/tst/nodes/variable.php", - "ezcTemplateTextBlockTstNode" => "Template/syntax_trees/tst/nodes/text_block.php", - "ezcTemplateFunctionCallTstNode" => "Template/syntax_trees/tst/nodes/function_call.php", - "ezcTemplateDocCommentTstNode" => "Template/syntax_trees/tst/nodes/doc_comment.php", - "ezcTemplateBlockCommentTstNode" => "Template/syntax_trees/tst/nodes/block_comment.php", - "ezcTemplateEolCommentTstNode" => "Template/syntax_trees/tst/nodes/eol_comment.php", - "ezcTemplateForeachLoopTstNode" => "Template/syntax_trees/tst/nodes/foreach_loop.php", - "ezcTemplateWhileLoopTstNode" => "Template/syntax_trees/tst/nodes/while_loop.php", - "ezcTemplateIfConditionTstNode" => "Template/syntax_trees/tst/nodes/if_condition.php", - "ezcTemplateSwitchTstNode" => "Template/syntax_trees/tst/nodes/switch.php", - "ezcTemplateCaseTstNode" => "Template/syntax_trees/tst/nodes/case.php", - "ezcTemplateLoopTstNode" => "Template/syntax_trees/tst/nodes/loop.php", - "ezcTemplatePropertyFetchOperatorTstNode" => "Template/syntax_trees/tst/nodes/property_fetch_operator.php", - "ezcTemplateArrayFetchOperatorTstNode" => "Template/syntax_trees/tst/nodes/array_fetch_operator.php", - "ezcTemplateArrayAppendOperatorTstNode" => "Template/syntax_trees/tst/nodes/array_append_operator.php", - "ezcTemplatePlusOperatorTstNode" => "Template/syntax_trees/tst/nodes/plus_operator.php", - "ezcTemplateMinusOperatorTstNode" => "Template/syntax_trees/tst/nodes/minus_operator.php", - "ezcTemplateConcatOperatorTstNode" => "Template/syntax_trees/tst/nodes/concat_operator.php", - "ezcTemplateMultiplicationOperatorTstNode" => "Template/syntax_trees/tst/nodes/multiplication_operator.php", - "ezcTemplateDivisionOperatorTstNode" => "Template/syntax_trees/tst/nodes/division_operator.php", - "ezcTemplateModuloOperatorTstNode" => "Template/syntax_trees/tst/nodes/modulo_operator.php", - "ezcTemplateEqualOperatorTstNode" => "Template/syntax_trees/tst/nodes/equal_operator.php", - "ezcTemplateNotEqualOperatorTstNode" => "Template/syntax_trees/tst/nodes/not_equal_operator.php", - "ezcTemplateIdenticalOperatorTstNode" => "Template/syntax_trees/tst/nodes/identical_operator.php", - "ezcTemplateNotIdenticalOperatorTstNode" => "Template/syntax_trees/tst/nodes/not_identical_operator.php", - "ezcTemplateLessThanOperatorTstNode" => "Template/syntax_trees/tst/nodes/less_than_operator.php", - "ezcTemplateGreaterThanOperatorTstNode" => "Template/syntax_trees/tst/nodes/greater_than_operator.php", - "ezcTemplateLessEqualOperatorTstNode" => "Template/syntax_trees/tst/nodes/less_equal_operator.php", - "ezcTemplateGreaterEqualOperatorTstNode" => "Template/syntax_trees/tst/nodes/greater_equal_operator.php", - "ezcTemplateLogicalAndOperatorTstNode" => "Template/syntax_trees/tst/nodes/logical_and_operator.php", - "ezcTemplateLogicalOrOperatorTstNode" => "Template/syntax_trees/tst/nodes/logical_or_operator.php", - "ezcTemplateAssignmentOperatorTstNode" => "Template/syntax_trees/tst/nodes/assignment_operator.php", - "ezcTemplatePlusAssignmentOperatorTstNode" => "Template/syntax_trees/tst/nodes/plus_assignment_operator.php", - "ezcTemplateMinusAssignmentOperatorTstNode" => "Template/syntax_trees/tst/nodes/minus_assignment_operator.php", - "ezcTemplateMultiplicationAssignmentOperatorTstNode" => "Template/syntax_trees/tst/nodes/multiplication_assignment_operator.php", - "ezcTemplateDivisionAssignmentOperatorTstNode" => "Template/syntax_trees/tst/nodes/division_assignment_operator.php", - "ezcTemplateConcatAssignmentOperatorTstNode" => "Template/syntax_trees/tst/nodes/concat_assignment_operator.php", - "ezcTemplateModuloAssignmentOperatorTstNode" => "Template/syntax_trees/tst/nodes/modulo_assignment_operator.php", - "ezcTemplatePreIncrementOperatorTstNode" => "Template/syntax_trees/tst/nodes/pre_increment_operator.php", - "ezcTemplatePreDecrementOperatorTstNode" => "Template/syntax_trees/tst/nodes/pre_decrement_operator.php", - "ezcTemplatePostIncrementOperatorTstNode" => "Template/syntax_trees/tst/nodes/post_increment_operator.php", - "ezcTemplatePostDecrementOperatorTstNode" => "Template/syntax_trees/tst/nodes/post_decrement_operator.php", - "ezcTemplateNegateOperatorTstNode" => "Template/syntax_trees/tst/nodes/negate_operator.php", - "ezcTemplateLogicalNegateOperatorTstNode" => "Template/syntax_trees/tst/nodes/logical_negate_operator.php", - "ezcTemplateInstanceOfOperatorTstNode" => "Template/syntax_trees/tst/nodes/instance_of_operator.php", - "ezcTemplateDeclarationTstNode" => "Template/syntax_trees/tst/nodes/declaration.php", - "ezcTemplateArrayRangeOperatorTstNode" => "Template/syntax_trees/tst/nodes/array_range_operator.php", - "ezcTemplateConditionBodyTstNode" => "Template/syntax_trees/tst/nodes/condition_body.php", - "ezcTemplateDelimiterTstNode" => "Template/syntax_trees/tst/nodes/delimiter.php", - "ezcTemplateCycleControlTstNode" => "Template/syntax_trees/tst/nodes/cycle_control.php", - "ezcTemplateIncludeTstNode" => "Template/syntax_trees/tst/nodes/include.php", - "ezcTemplateReturnTstNode" => "Template/syntax_trees/tst/nodes/return.php", - "ezcTemplateIdentifierTstNode" => "Template/syntax_trees/tst/nodes/identifier.php", - -// Syntax trees / AST - "ezcTemplateAstBuilder" => "Template/syntax_trees/ast/ast_builder.php", - -// Syntax trees / AST interfaces - "ezcTemplateAstNode" => "Template/syntax_trees/ast/interfaces/ast_node.php", - "ezcTemplateParameterizedAstNode" => "Template/syntax_trees/ast/interfaces/parameterized_ast.php", - "ezcTemplateOperatorAstNode" => "Template/syntax_trees/ast/interfaces/operator_ast.php", - "ezcTemplateBinaryOperatorAstNode" => "Template/syntax_trees/ast/interfaces/binary_operator.php", - "ezcTemplateStatementAstNode" => "Template/syntax_trees/ast/interfaces/statement_ast.php", - "ezcTemplateAstNodeVisitor" => "Template/syntax_trees/ast/interfaces/ast_visitor.php", - -// Syntax trees / AST nodes - "ezcTemplateNopAstNode" => "Template/syntax_trees/ast/nodes/nop.php", - "ezcTemplateLiteralAstNode" => "Template/syntax_trees/ast/nodes/literal.php", - "ezcTemplateLiteralArrayAstNode" => "Template/syntax_trees/ast/nodes/literalarray.php", - "ezcTemplateOutputAstNode" => "Template/syntax_trees/ast/nodes/output.php", - "ezcTemplateTypeCastAstNode" => "Template/syntax_trees/ast/nodes/type_cast.php", - "ezcTemplateConstantAstNode" => "Template/syntax_trees/ast/nodes/constant.php", - "ezcTemplateIdentifierAstNode" => "Template/syntax_trees/ast/nodes/identifier.php", - "ezcTemplateEolCommentAstNode" => "Template/syntax_trees/ast/nodes/eol_comment.php", - "ezcTemplateBlockCommentAstNode" => "Template/syntax_trees/ast/nodes/block_comment.php", - "ezcTemplateVariableAstNode" => "Template/syntax_trees/ast/nodes/variable.php", - "ezcTemplateDynamicVariableAstNode" => "Template/syntax_trees/ast/nodes/dynamic_variable.php", - "ezcTemplateDynamicStringAstNode" => "Template/syntax_trees/ast/nodes/dynamic_string.php", - "ezcTemplateBodyAstNode" => "Template/syntax_trees/ast/nodes/body.php", - "ezcTemplateGenericStatementAstNode" => "Template/syntax_trees/ast/nodes/generic_statement.php", - "ezcTemplateFunctionCallAstNode" => "Template/syntax_trees/ast/nodes/function_call.php", - "ezcTemplateConditionBodyAstNode" => "Template/syntax_trees/ast/nodes/condition_body.php", - "ezcTemplateParenthesisAstNode" => "Template/syntax_trees/ast/nodes/parenthesis.php", - "ezcTemplateCurlyBracesAstNode" => "Template/syntax_trees/ast/nodes/curly_braces.php", - "ezcTemplatePhpCodeAstNode" => "Template/syntax_trees/ast/nodes/php_code.php", - - // Control - "ezcTemplateIfAstNode" => "Template/syntax_trees/ast/nodes/control/if.php", - "ezcTemplateWhileAstNode" => "Template/syntax_trees/ast/nodes/control/while.php", - "ezcTemplateDoWhileAstNode" => "Template/syntax_trees/ast/nodes/control/do_while.php", - "ezcTemplateForAstNode" => "Template/syntax_trees/ast/nodes/control/for.php", - "ezcTemplateForeachAstNode" => "Template/syntax_trees/ast/nodes/control/foreach.php", - "ezcTemplateBreakAstNode" => "Template/syntax_trees/ast/nodes/control/break.php", - "ezcTemplateContinueAstNode" => "Template/syntax_trees/ast/nodes/control/continue.php", - "ezcTemplateSwitchAstNode" => "Template/syntax_trees/ast/nodes/control/switch.php", - "ezcTemplateCaseAstNode" => "Template/syntax_trees/ast/nodes/control/case.php", - "ezcTemplateDefaultAstNode" => "Template/syntax_trees/ast/nodes/control/default.php", - "ezcTemplateReturnAstNode" => "Template/syntax_trees/ast/nodes/control/return.php", - "ezcTemplateRequireAstNode" => "Template/syntax_trees/ast/nodes/control/require.php", - "ezcTemplateRequireOnceAstNode" => "Template/syntax_trees/ast/nodes/control/require_once.php", - "ezcTemplateIncludeAstNode" => "Template/syntax_trees/ast/nodes/control/include.php", - "ezcTemplateIncludeOnceAstNode" => "Template/syntax_trees/ast/nodes/control/include_once.php", - "ezcTemplateTryAstNode" => "Template/syntax_trees/ast/nodes/control/try.php", - "ezcTemplateCatchAstNode" => "Template/syntax_trees/ast/nodes/control/catch.php", - - // Constructs - "ezcTemplateEchoAstNode" => "Template/syntax_trees/ast/nodes/constructs/echo.php", - "ezcTemplatePrintAstNode" => "Template/syntax_trees/ast/nodes/constructs/print.php", - "ezcTemplateIssetAstNode" => "Template/syntax_trees/ast/nodes/constructs/isset.php", - "ezcTemplateUnsetAstNode" => "Template/syntax_trees/ast/nodes/constructs/unset.php", - "ezcTemplateEmptyAstNode" => "Template/syntax_trees/ast/nodes/constructs/empty.php", - "ezcTemplateNewAstNode" => "Template/syntax_trees/ast/nodes/constructs/new.php", - "ezcTemplateCloneAstNode" => "Template/syntax_trees/ast/nodes/constructs/clone.php", - - // Operators - "ezcTemplateArrayFetchOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/array_fetch_operator.php", - "ezcTemplateArrayAppendOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/array_append_assignment_operator.php", - "ezcTemplateAssignmentOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/assignment_operator.php", - "ezcTemplateObjectAccessOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/object_access_operator.php", - "ezcTemplateConcatAssignmentOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/concat_assignment_operator.php", - "ezcTemplateDivisionAssignmentOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/division_assignment_operator.php", - "ezcTemplateSubtractionAssignmentOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/subtraction_assignment_operator.php", - "ezcTemplateModulusAssignmentOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/modulus_assignment_operator.php", - "ezcTemplateMultiplicationAssignmentOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/multiplication_assignment_operator.php", - "ezcTemplateAdditionAssignmentOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/addition_assignment_operator.php", - "ezcTemplateBitwiseAndAssignmentOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/bitwise_and_assignment_operator.php", - "ezcTemplateBitwiseOrAssignmentOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/bitwise_or_assignment_operator.php", - "ezcTemplateBitwiseXorAssignmentOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/bitwise_xor_assignment_operator.php", - "ezcTemplateShiftLeftAssignmentOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/shift_left_assignment_operator.php", - "ezcTemplateShiftRightAssignmentOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/shift_right_assignment_operator.php", - "ezcTemplateArithmeticNegationOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/arithmetic_negation_operator.php", - "ezcTemplateConcatOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/concat_operator.php", - "ezcTemplateEqualOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/equal_operator.php", - "ezcTemplateGreaterEqualOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/greater_equal_operator.php", - "ezcTemplateGreaterThanOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/greater_than_operator.php", - "ezcTemplateIdenticalOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/identical_operator.php", - "ezcTemplateInstanceofOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/instanceof_operator.php", - "ezcTemplateIncrementOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/increment_operator.php", - "ezcTemplateDecrementOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/decrement_operator.php", - "ezcTemplateLessEqualOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/less_equal_operator.php", - "ezcTemplateLessThanOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/less_than_operator.php", - "ezcTemplateLogicalAndOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/logical_and_operator.php", - "ezcTemplateLogicalOrOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/logical_or_operator.php", - "ezcTemplateLogicalNegationOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/logical_negation_operator.php", - "ezcTemplateLogicalLiteralAndOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/logical_literal_and_operator.php", - "ezcTemplateLogicalLiteralOrOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/logical_literal_or_operator.php", - "ezcTemplateLogicalLiteralXorOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/logical_literal_xor_operator.php", - "ezcTemplateBitwiseAndOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/bitwise_and_operator.php", - "ezcTemplateBitwiseOrOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/bitwise_or_operator.php", - "ezcTemplateBitwiseXorOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/bitwise_xor_operator.php", - "ezcTemplateBitwiseNegationOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/bitwise_negation_operator.php", - "ezcTemplateShiftLeftOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/shift_left_operator.php", - "ezcTemplateShiftRightOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/shift_right_operator.php", - "ezcTemplateSubtractionOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/subtraction_operator.php", - "ezcTemplateDivisionOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/division_operator.php", - "ezcTemplateModulusOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/modulus_operator.php", - "ezcTemplateMultiplicationOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/multiplication_operator.php", - "ezcTemplateNotEqualOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/not_equal_operator.php", - "ezcTemplateNotIdenticalOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/not_identical_operator.php", - "ezcTemplateAdditionOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/addition_operator.php", - "ezcTemplateReferenceOperatorAstNode" => "Template/syntax_trees/ast/nodes/operators/reference_operator.php", - -///////////////////////////////////////////////////////// PARSERS /////////////////////////////////////////////////////////////////////// - -// Parsers / source_to_tst interfaces - "ezcTemplateSourceToTstParser" => "Template/parsers/source_to_tst/interfaces/source_to_tst_parser.php", - -// Parsers / source_to_tst implementations - "ezcTemplateProgramSourceToTstParser" => "Template/parsers/source_to_tst/implementations/program.php", - "ezcTemplateBlockSourceToTstParser" => "Template/parsers/source_to_tst/implementations/block.php", - "ezcTemplateLiteralBlockSourceToTstParser" => "Template/parsers/source_to_tst/implementations/literal_block.php", - "ezcTemplateControlStructureSourceToTstParser" => "Template/parsers/source_to_tst/implementations/control_structure.php", - "ezcTemplateCustomBlockSourceToTstParser" => "Template/parsers/source_to_tst/implementations/custom_block.php", - "ezcTemplateForeachLoopSourceToTstParser" => "Template/parsers/source_to_tst/implementations/foreach_loop.php", - "ezcTemplateWhileLoopSourceToTstParser" => "Template/parsers/source_to_tst/implementations/while_loop.php", - "ezcTemplateIfConditionSourceToTstParser" => "Template/parsers/source_to_tst/implementations/if_condition.php", - "ezcTemplateSwitchConditionSourceToTstParser" => "Template/parsers/source_to_tst/implementations/switch_condition.php", - "ezcTemplateLoopSourceToTstParser" => "Template/parsers/source_to_tst/implementations/loop.php", - "ezcTemplateExpressionBlockSourceToTstParser" => "Template/parsers/source_to_tst/implementations/expression_block.php", - "ezcTemplateExpressionSourceToTstParser" => "Template/parsers/source_to_tst/implementations/expression.php", - "ezcTemplateDeclarationBlockSourceToTstParser" => "Template/parsers/source_to_tst/implementations/declaration.php", - "ezcTemplateLiteralSourceToTstParser" => "Template/parsers/source_to_tst/implementations/literal.php", - "ezcTemplateIntegerSourceToTstParser" => "Template/parsers/source_to_tst/implementations/integer.php", - "ezcTemplateFloatSourceToTstParser" => "Template/parsers/source_to_tst/implementations/float.php", - "ezcTemplateStringSourceToTstParser" => "Template/parsers/source_to_tst/implementations/string.php", - "ezcTemplateBoolSourceToTstParser" => "Template/parsers/source_to_tst/implementations/bool.php", - "ezcTemplateArraySourceToTstParser" => "Template/parsers/source_to_tst/implementations/array.php", - "ezcTemplateFunctionCallSourceToTstParser" => "Template/parsers/source_to_tst/implementations/function_call.php", - "ezcTemplateArrayFetchSourceToTstParser" => "Template/parsers/source_to_tst/implementations/array_fetch.php", - "ezcTemplateVariableSourceToTstParser" => "Template/parsers/source_to_tst/implementations/variable.php", - "ezcTemplateIdentifierSourceToTstParser" => "Template/parsers/source_to_tst/implementations/identifier.php", - "ezcTemplateDocCommentSourceToTstParser" => "Template/parsers/source_to_tst/implementations/doc_comment.php", - "ezcTemplateBlockCommentSourceToTstParser" => "Template/parsers/source_to_tst/implementations/block_comment.php", - "ezcTemplateEolCommentSourceToTstParser" => "Template/parsers/source_to_tst/implementations/eol_comment.php", - "ezcTemplateDelimiterSourceToTstParser" => "Template/parsers/source_to_tst/implementations/delimiter.php", - "ezcTemplateCycleS