euromark 12 years ago
parent
commit
2c290bed77

+ 73 - 4
Console/Command/CcShell.php

@@ -18,12 +18,17 @@ if (!defined('LF')) {
  */
 class CcShell extends AppShell {
 
-	protected $plugins = null;
+	public $plugins = null;
 
-	protected $content = '';
+	public $content = '';
 
-	protected $appFiles = array();
+	public $appFiles = array();
 
+	/**
+	 * CcShell::main()
+	 *
+	 * @return void
+	 */
 	public function main() {
 		$this->out('Code Completion Dump - customized for PHPDesigner');
 
@@ -43,6 +48,11 @@ class CcShell extends AppShell {
 		$this->out('...done');
 	}
 
+	/**
+	 * CcShell::models()
+	 *
+	 * @return void
+	 */
 	public function models() {
 		$files = $this->_getFiles('Model');
 
@@ -59,6 +69,11 @@ class CcShell extends AppShell {
 		$this->content .= $content;
 	}
 
+	/**
+	 * CcShell::behaviors()
+	 *
+	 * @return void
+	 */
 	public function behaviors() {
 		$files = $this->_getFiles('Model/Behavior');
 
@@ -76,6 +91,8 @@ class CcShell extends AppShell {
 
 	/**
 	 * Components + models
+	 *
+	 * @return void
 	 */
 	public function controller() {
 		$content = LF;
@@ -100,6 +117,11 @@ class CcShell extends AppShell {
 		$this->content .= $content;
 	}
 
+	/**
+	 * CcShell::helpers()
+	 *
+	 * @return void
+	 */
 	public function helpers() {
 		$files = $this->_getFiles('View/Helper');
 		$content = LF;
@@ -114,6 +136,11 @@ class CcShell extends AppShell {
 		$this->content .= $content;
 	}
 
+	/**
+	 * CcShell::appFiles()
+	 *
+	 * @return void
+	 */
 	public function appFiles() {
 		$files = $this->appFiles;
 		$content = LF;
@@ -126,6 +153,12 @@ class CcShell extends AppShell {
 		$this->content .= $content;
 	}
 
+	/**
+	 * CcShell::_prepAppFiles()
+	 *
+	 * @param mixed $files
+	 * @return string
+	 */
 	protected function _prepAppFiles($files) {
 		$res = '';
 		foreach ($files as $name => $parent) {
@@ -134,6 +167,12 @@ class CcShell extends AppShell {
 		return $res;
 	}
 
+	/**
+	 * CcShell::_prepModels()
+	 *
+	 * @param mixed $files
+	 * @return string
+	 */
 	protected function _prepModels($files) {
 		$res = '';
 		foreach ($files as $name) {
@@ -159,6 +198,12 @@ class CcShell extends AppShell {
 		return $res;
 	}
 
+	/**
+	 * CcShell::_prepBehaviors()
+	 *
+	 * @param mixed $files
+	 * @return string
+	 */
 	protected function _prepBehaviors($files) {
 		$res = '';
 		foreach ($files as $name) {
@@ -191,15 +236,22 @@ class CcShell extends AppShell {
 
 	/**
 	 * Check on correctness to avoid duplicates
+	 *
+	 * @return void
 	 */
 	protected function _varName($name, $type) {
 		if (($pos = strrpos($name, $type)) === false) {
 			return '';
-			//return $name;
 		}
 		return substr($name, 0, $pos);
 	}
 
+	/**
+	 * CcShell::_prepComponents()
+	 *
+	 * @param mixed $files
+	 * @return string
+	 */
 	protected function _prepComponents($files) {
 		$res = '';
 		foreach ($files as $name) {
@@ -230,6 +282,12 @@ class CcShell extends AppShell {
 		return $res;
 	}
 
+	/**
+	 * CcShell::_prepHelpers()
+	 *
+	 * @param mixed $files
+	 * @return string
+	 */
 	protected function _prepHelpers($files) {
 		# new ones
 		$res = '';
@@ -263,6 +321,11 @@ class CcShell extends AppShell {
 		return $res;
 	}
 
+	/**
+	 * CcShell::_dump()
+	 *
+	 * @return void
+	 */
 	protected function _dump() {
 		//$File = new File($this->filename, true);
 
@@ -276,6 +339,12 @@ class CcShell extends AppShell {
 		file_put_contents($this->filename, $content);
 	}
 
+	/**
+	 * CcShell::_getFiles()
+	 *
+	 * @param mixed $type
+	 * @return array
+	 */
 	protected function _getFiles($type) {
 		$files = App::objects($type, null, false);
 		$corePath = App::core($type);

+ 29 - 16
Console/Command/CodeShell.php

@@ -21,6 +21,8 @@ class CodeShell extends AppShell {
 
 	/**
 	 * Detect and fix class dependencies
+	 *
+	 * @return void
 	 */
 	public function dependencies() {
 		if ($customPath = $this->params['custom']) {
@@ -193,6 +195,12 @@ class CodeShell extends AppShell {
 		$this->_filesRegexpUpdate($patterns);
 	}
 
+	/**
+	 * CodeShell::_filesRegexpUpdate()
+	 *
+	 * @param mixed $patterns
+	 * @return void
+	 */
 	protected function _filesRegexpUpdate($patterns) {
 		$this->_findFiles($this->params['ext']);
 		foreach ($this->_files as $file) {
@@ -201,12 +209,12 @@ class CodeShell extends AppShell {
 		}
 	}
 
-/**
- * Searches the paths and finds files based on extension.
- *
- * @param string $extensions
- * @return void
- */
+	/**
+	 * Searches the paths and finds files based on extension.
+	 *
+	 * @param string $extensions
+	 * @return void
+	 */
 	protected function _findFiles($extensions = '') {
 		$this->_files = array();
 		foreach ($this->_paths as $path) {
@@ -246,6 +254,13 @@ class CodeShell extends AppShell {
 		}
 	}
 
+	/**
+	 * CodeShell::_utf8File()
+	 *
+	 * @param mixed $file
+	 * @param mixed $patterns
+	 * @return void
+	 */
 	protected function _utf8File($file, $patterns) {
 		$contents = $fileContent = file_get_contents($file);
 
@@ -314,23 +329,21 @@ class CodeShell extends AppShell {
 			));
 	}
 
-/** old stuff **/
-
 	/**
-	* Shell tasks
-	*
-	* @var array
-	*/
+	 * Shell tasks
+	 *
+	 * @var array
+	 */
 	public $tasks = array(
 		'CodeConvention',
 		'CodeWhitespace'
 	);
 
 	/**
-	* Main execution function
-	*
-	* @return void
-	*/
+	 * Main execution function
+	 *
+	 * @return void
+	 */
 	public function group() {
 		if (!empty($this->args)) {
 			if (!empty($this->args[1])) {

+ 5 - 0
Console/Command/CopyShell.php

@@ -72,6 +72,7 @@ class CopyShell extends AppShell {
 	);
 
 	public $type = self::TYPE_APP;
+
 	public $configName = null; # like "test" in "app_test" or "123" in "custom_123"
 	# both typeName and configName form the "site" name: typeName_configName
 
@@ -79,9 +80,13 @@ class CopyShell extends AppShell {
 	public $configGlobal = array(); # configFile Content
 
 	public $tmpFolder = null;
+
 	public $tmpFile = null;
+
 	public $logFile = null;
+
 	public $localFolder = APP;
+
 	public $remoteFolder = null;
 
 	/**

+ 1 - 9
Console/Command/EncodingShell.php

@@ -19,14 +19,6 @@ class EncodingShell extends AppShell {
 	protected $_found = array();
 
 	/**
-	 * @return void
-	 */
-	public function startup() {
-		parent::startup();
-
-	}
-
-	/**
 	 * ConvertShell::folder()
 	 *
 	 * @return void
@@ -82,7 +74,7 @@ class EncodingShell extends AppShell {
 	 * @param array $excludes
 	 * @return void
 	 */
-	public function _detect($path, $extensions, $excludes = array()) {
+	protected function _detect($path, $extensions, $excludes = array()) {
 		$Iterator = new RegexIterator(
 			new RecursiveIteratorIterator(new RecursiveDirectoryIterator($path)),
 			'/^.+\.(' . $extensions . ')$/i',

+ 2 - 2
Console/Command/FolderSyncShell.php

@@ -111,7 +111,7 @@ class FolderSyncShell extends AppShell {
 			$targetFile = $file;
 			$file = str_replace($this->targetFolder, '', $targetFile);
 			$sourceFile = $this->sourceFolder . $file;
-			$this->updateFile($targetFile, $sourceFile, $file);
+			$this->_updateFile($targetFile, $sourceFile, $file);
 		}
 	}
 
@@ -120,7 +120,7 @@ class FolderSyncShell extends AppShell {
 	 * @param source - does not have to exists
 	 * @return void;
 	 */
-	protected function updateFile($target, $source, $name = null) {
+	protected function _updateFile($target, $source, $name = null) {
 		if (!$name) {
 			$name = $target;
 		}

+ 21 - 7
Console/Command/IndentShell.php

@@ -46,7 +46,7 @@ class IndentShell extends AppShell {
 		'debug' => false # add debug info after each line
 	);
 
-	protected $changes = null;
+	protected $_changes = null;
 
 	protected $_paths = array();
 
@@ -114,6 +114,13 @@ class IndentShell extends AppShell {
 		}
 	}
 
+	/**
+	 * IndentShell::_write()
+	 *
+	 * @param mixed $file
+	 * @param mixed $text
+	 * @return boolean Success
+	 */
 	protected function _write($file, $text) {
 		$text = implode(PHP_EOL, $text);
 		if ($this->settings['outputToTmp']) {
@@ -123,9 +130,15 @@ class IndentShell extends AppShell {
 			}
 			$file = extractPathInfo('dir', $file) . DS . $filename . '_.' . extractPathInfo('ext', $file);
 		}
-		return file_put_contents($file, $text);
+		return (bool)file_put_contents($file, $text);
 	}
 
+	/**
+	 * IndentShell::_read()
+	 *
+	 * @param mixed $file
+	 * @return array
+	 */
 	protected function _read($file) {
 		$text = file_get_contents($file);
 		if (empty($text)) {
@@ -139,10 +152,11 @@ class IndentShell extends AppShell {
 	 * NEW TRY!
 	 * idea: just count spaces and replace those
 	 *
+	 * @return void
 	 */
 	protected function _correctFiles() {
 		foreach ($this->_files as $file) {
-			$this->changes = false;
+			$this->_changes = false;
 			$textCorrect = array();
 
 			$pieces = $this->_read($file);
@@ -157,7 +171,7 @@ class IndentShell extends AppShell {
 				$textCorrect[] = $tmp;
 			}
 
-			if ($this->changes) {
+			if ($this->_changes) {
 				$this->_write($file, $textCorrect);
 			}
 		}
@@ -180,7 +194,7 @@ class IndentShell extends AppShell {
 			$piece1 = mb_substr($piece, 0, $pos + 1);
 			$piece1 = str_replace(str_repeat(' ', $spacesPerTab), TB, $piece1, $count);
 			if ($count > 0) {
-				$this->changes = true;
+				$this->_changes = true;
 			}
 
 			$piece2 = mb_substr($piece, $pos + 1);
@@ -190,7 +204,7 @@ class IndentShell extends AppShell {
 
 		$newPiece = rtrim($newPiece) . $debug;
 		if ($newPiece != $piece || strlen($newPiece) !== strlen($piece)) {
-			$this->changes = true;
+			$this->_changes = true;
 		}
 		return $newPiece;
 	}
@@ -209,7 +223,7 @@ class IndentShell extends AppShell {
 			$newPiece = mb_substr($piece, $space);
 		}
 		if ($newPiece != $piece || strlen($newPiece) !== strlen($piece)) {
-			$this->changes = true;
+			$this->_changes = true;
 		}
 		return $newPiece;
 	}

+ 3 - 0
Console/Command/PhpTagShell.php

@@ -13,6 +13,7 @@ App::uses('Folder', 'Utility');
 class PhpTagShell extends AppShell {
 
 	public $autoCorrectAll = false;
+
 	# each report: [0] => found, [1] => corrected
 	public $report = array(
 		'leading' => array(0, 0),
@@ -28,6 +29,8 @@ class PhpTagShell extends AppShell {
 	/**
 	 * note: uses provided folder (first param)
 	 * otherwise complete APP
+	 *
+	 * @return void
 	 */
 	public function run() {
 		if (isset($this->args[0]) && !empty($this->args[0])) {

+ 15 - 2
Console/Command/ResetShell.php

@@ -14,17 +14,22 @@ App::uses('AppShell', 'Console/Command');
  * @license MIT
  */
 class ResetShell extends AppShell {
-	public $tasks = array();
-	//public $uses = array('User');
 
 	public $Auth = null;
 
+	/**
+	 * ResetShell::main()
+	 *
+	 * @return void
+	 */
 	public function main() {
 		$this->help();
 	}
 
 	/**
 	 * Reset all emails - e.g. your admin email (for local development)
+	 *
+	 * @return void
 	 */
 	public function email() {
 		$this->out('email:');
@@ -49,6 +54,8 @@ class ResetShell extends AppShell {
 
 	/**
 	 * Reset all pwds to a simply pwd (for local development)
+	 *
+	 * @return void
 	 */
 	public function pwd() {
 		$components = array('Tools.AuthExt', 'Auth');
@@ -99,8 +106,14 @@ class ResetShell extends AppShell {
 		$this->out($count . ' pwds resetted - DONE');
 	}
 
+	/**
+	 * ResetShell::help()
+	 *
+	 * @return void
+	 */
 	public function help() {
 		$this->out('-- pwd: Hash and Reset all user passwords with Auth(Ext) Component --');
 		$this->out('-- email: Reset all user emails --');
 	}
+
 }

+ 7 - 3
Console/Command/UserShell.php

@@ -17,12 +17,16 @@ App::uses('ComponentCollection', 'Controller');
  */
 class UserShell extends AppShell {
 
-	public $tasks = array();
 	public $uses = array(CLASS_USER);
 
-	//TODO: refactor (smaller sub-parts)
+	/**
+	 * UserShell::main()
+	 * //TODO: refactor (smaller sub-parts)
+	 *
+	 * @return void
+	 */
 	public function main() {
-		if (App::import('Component', 'AuthExt') && class_exists('AuthExtComponent')) {
+		if (App::import('Component', 'Tools.AuthExt') && class_exists('AuthExtComponent')) {
 			$this->Auth = new AuthExtComponent(new ComponentCollection());
 		} else {
 			App::import('Component', 'Auth');

+ 6 - 0
View/Helper/PhpThumbHelper.php

@@ -10,11 +10,17 @@ App::uses('AppHelper', 'View/Helper');
 class PhpThumbHelper extends AppHelper {
 
 	protected $PhpThumb;
+
 	protected $options;
+
 	protected $file_extension;
+
 	protected $cache_filename;
+
 	protected $thumb_data;
+
 	protected $error;
+
 	protected $error_detail;
 
 	protected function init($options = array()) {