@@ -3,19 +3,19 @@ |
||
| 3 | 3 | /** |
| 4 | 4 | * Data Entity implementation for this class |
| 5 | 5 | * |
| 6 | - * <?=$this->config->last_modify."\n"?> |
|
| 6 | + * <?=$this->config->last_modify . "\n"?> |
|
| 7 | 7 | * |
| 8 | 8 | * @package <?=$objTables->getNamespace()?> |
| 9 | - * @see <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?>. <?="\n"?> |
|
| 9 | + * @see <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?>. <?="\n"?> |
|
| 10 | 10 | * |
| 11 | - * @author <?=$this->config->author."\n"?> |
|
| 11 | + * @author <?=$this->config->author . "\n"?> |
|
| 12 | 12 | * |
| 13 | - * @copyright <?=$this->config->copyright."\n"?> |
|
| 14 | - * @license <?=$this->config->license."\n"?> |
|
| 15 | - * @link <?=$this->config->link."\n"?> |
|
| 13 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 14 | + * @license <?=$this->config->license . "\n"?> |
|
| 15 | + * @link <?=$this->config->link . "\n"?> |
|
| 16 | 16 | */ |
| 17 | 17 | |
| 18 | -class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () )?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName ( $objTables->getName () ). "\n"?> |
|
| 18 | +class <?=$objTables->getNamespace()?>_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName())?> extends <?=$objTables->getNamespace()?>_Entity_<?=\Classes\Maker\AbstractMaker::getClassName($objTables->getName()) . "\n"?> |
|
| 19 | 19 | { |
| 20 | 20 | /* Codifique aqui */ |
| 21 | 21 | } |
@@ -3,15 +3,15 @@ |
||
| 3 | 3 | /** |
| 4 | 4 | * Application Entity |
| 5 | 5 | * |
| 6 | - * <?=$this->config->last_modify."\n"?> |
|
| 6 | + * <?=$this->config->last_modify . "\n"?> |
|
| 7 | 7 | * |
| 8 | 8 | * @package <?=$this->config->namespace?>Model |
| 9 | 9 | * @subpackage Model |
| 10 | - * @author <?=$this->config->author."\n"?> |
|
| 10 | + * @author <?=$this->config->author . "\n"?> |
|
| 11 | 11 | * |
| 12 | - * @copyright <?=$this->config->copyright."\n"?> |
|
| 13 | - * @license <?=$this->config->license."\n"?> |
|
| 14 | - * @link <?=$this->config->link."\n"?> |
|
| 12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 13 | + * @license <?=$this->config->license . "\n"?> |
|
| 14 | + * @link <?=$this->config->link . "\n"?> |
|
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | abstract class <?=$this->config->namespace?>Model_EntityAbstract extends Zend_Db_Table_Row_Abstract |
@@ -20,13 +20,13 @@ |
||
| 20 | 20 | ; database host |
| 21 | 21 | host = <?= $host ?><?= "\n" ?> |
| 22 | 22 | ; database name |
| 23 | -database = "<?= isset( $database ) ? $database : '' ?>"<?= "\n" ?> |
|
| 23 | +database = "<?= isset($database) ? $database : '' ?>"<?= "\n" ?> |
|
| 24 | 24 | ; database schema name (one or more than one) |
| 25 | -<?= isset( $schema ) ? 'schema = ' . $schema : ';schema = public' ?><?= "\n" ?> |
|
| 25 | +<?= isset($schema) ? 'schema = ' . $schema : ';schema = public' ?><?= "\n" ?> |
|
| 26 | 26 | ; database user |
| 27 | -username = <?= isset( $username ) ? $username : '' ?><?= "\n" ?> |
|
| 27 | +username = <?= isset($username) ? $username : '' ?><?= "\n" ?> |
|
| 28 | 28 | ; database password |
| 29 | -password = <?= isset( $password ) ? $password : '' ?><?= "\n" ?> |
|
| 29 | +password = <?= isset($password) ? $password : '' ?><?= "\n" ?> |
|
| 30 | 30 | ; show status of implementation carried out after completing the process |
| 31 | 31 | status = false |
| 32 | 32 | ; specify where to create the files (default is current directory) |
@@ -10,13 +10,13 @@ discard block |
||
| 10 | 10 | * |
| 11 | 11 | * @param $dir |
| 12 | 12 | */ |
| 13 | - public static function makeDir ( $dir ) |
|
| 13 | + public static function makeDir($dir) |
|
| 14 | 14 | { |
| 15 | - if ( !is_dir ( $dir ) ) |
|
| 15 | + if ( ! is_dir($dir)) |
|
| 16 | 16 | { |
| 17 | - if ( !@mkdir ( $dir, 0755, true ) ) |
|
| 17 | + if ( ! @mkdir($dir, 0755, true)) |
|
| 18 | 18 | { |
| 19 | - die( "error: could not create directory $dir\n" ); |
|
| 19 | + die("error: could not create directory $dir\n"); |
|
| 20 | 20 | } |
| 21 | 21 | } |
| 22 | 22 | } |
@@ -26,16 +26,16 @@ discard block |
||
| 26 | 26 | * @param string $tplContent Conteudo do Template |
| 27 | 27 | * @param bool $overwrite Sobrescreve o arquivo ja existente |
| 28 | 28 | */ |
| 29 | - public static function makeSourcer ( $nameFile, $tplContent, $overwrite = false ) |
|
| 29 | + public static function makeSourcer($nameFile, $tplContent, $overwrite = false) |
|
| 30 | 30 | { |
| 31 | - if ( !$overwrite && is_file ( $nameFile ) ) |
|
| 31 | + if ( ! $overwrite && is_file($nameFile)) |
|
| 32 | 32 | { |
| 33 | 33 | return; |
| 34 | 34 | } |
| 35 | 35 | |
| 36 | - if ( !file_put_contents ( $nameFile, $tplContent ) ) |
|
| 36 | + if ( ! file_put_contents($nameFile, $tplContent)) |
|
| 37 | 37 | { |
| 38 | - die( "Error: could not write model file $nameFile." ); |
|
| 38 | + die("Error: could not write model file $nameFile."); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -46,24 +46,24 @@ discard block |
||
| 46 | 46 | * |
| 47 | 47 | * @return string |
| 48 | 48 | */ |
| 49 | - public static function getClassName ( $str ) |
|
| 49 | + public static function getClassName($str) |
|
| 50 | 50 | { |
| 51 | 51 | $temp = ''; |
| 52 | - foreach ( explode ( self::SEPARETOR, $str ) as $part ) |
|
| 52 | + foreach (explode(self::SEPARETOR, $str) as $part) |
|
| 53 | 53 | { |
| 54 | - $temp .= ucfirst ( $part ); |
|
| 54 | + $temp .= ucfirst($part); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | return $temp; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - protected function getParsedTplContents ( $filePath, $vars = array () ) |
|
| 60 | + protected function getParsedTplContents($filePath, $vars = array()) |
|
| 61 | 61 | { |
| 62 | - extract ( $vars ); |
|
| 63 | - ob_start (); |
|
| 62 | + extract($vars); |
|
| 63 | + ob_start(); |
|
| 64 | 64 | require $filePath; |
| 65 | - $data = ob_get_contents (); |
|
| 66 | - ob_end_clean (); |
|
| 65 | + $data = ob_get_contents(); |
|
| 66 | + ob_end_clean(); |
|
| 67 | 67 | |
| 68 | 68 | return $data; |
| 69 | 69 | } |
@@ -1,32 +1,32 @@ |
||
| 1 | 1 | <?php |
| 2 | -define ( 'PREFIX', 'orm-generator' ); |
|
| 3 | -define ( 'PHAR_FILE', PREFIX . '.phar' ); |
|
| 4 | -define ( 'PHAR_OUTPUT', 'bin' . DIRECTORY_SEPARATOR . PHAR_FILE ); |
|
| 5 | -define ( 'DEFAULT_STUB', 'phar-generate.php' ); |
|
| 6 | -define ( 'BUILD_DIR', realpath ( __DIR__ . '/build' ) ); |
|
| 7 | -define ( 'INCLUDE_EXTENSION', '/\.php$/' ); |
|
| 2 | +define('PREFIX', 'orm-generator'); |
|
| 3 | +define('PHAR_FILE', PREFIX . '.phar'); |
|
| 4 | +define('PHAR_OUTPUT', 'bin' . DIRECTORY_SEPARATOR . PHAR_FILE); |
|
| 5 | +define('DEFAULT_STUB', 'phar-generate.php'); |
|
| 6 | +define('BUILD_DIR', realpath(__DIR__ . '/build')); |
|
| 7 | +define('INCLUDE_EXTENSION', '/\.php$/'); |
|
| 8 | 8 | |
| 9 | 9 | try |
| 10 | 10 | { |
| 11 | - if ( file_exists ( PHAR_OUTPUT ) ) |
|
| 11 | + if (file_exists(PHAR_OUTPUT)) |
|
| 12 | 12 | { |
| 13 | - unlink ( PHAR_OUTPUT ); |
|
| 13 | + unlink(PHAR_OUTPUT); |
|
| 14 | 14 | } |
| 15 | 15 | |
| 16 | 16 | /**************************************** |
| 17 | 17 | * phar file creation |
| 18 | 18 | ****************************************/ |
| 19 | - $tarphar = new Phar( PHAR_OUTPUT ); |
|
| 20 | - $phar = $tarphar->convertToExecutable ( Phar::PHAR ); |
|
| 21 | - $phar->startBuffering (); |
|
| 22 | - $phar->buildFromDirectory ( BUILD_DIR, INCLUDE_EXTENSION ); |
|
| 23 | - $stub = $phar->createDefaultStub ( DEFAULT_STUB ); |
|
| 24 | - $phar->setStub ( "#!/usr/bin/php\n" . $stub ); |
|
| 25 | - $phar->stopBuffering (); |
|
| 19 | + $tarphar = new Phar(PHAR_OUTPUT); |
|
| 20 | + $phar = $tarphar->convertToExecutable(Phar::PHAR); |
|
| 21 | + $phar->startBuffering(); |
|
| 22 | + $phar->buildFromDirectory(BUILD_DIR, INCLUDE_EXTENSION); |
|
| 23 | + $stub = $phar->createDefaultStub(DEFAULT_STUB); |
|
| 24 | + $phar->setStub("#!/usr/bin/php\n" . $stub); |
|
| 25 | + $phar->stopBuffering(); |
|
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | } |
| 29 | -catch ( Exception $e ) |
|
| 29 | +catch (Exception $e) |
|
| 30 | 30 | { |
| 31 | 31 | echo $e; |
| 32 | 32 | } |
| 33 | 33 | \ No newline at end of file |
@@ -25,8 +25,7 @@ |
||
| 25 | 25 | $phar->stopBuffering (); |
| 26 | 26 | |
| 27 | 27 | |
| 28 | -} |
|
| 29 | -catch ( Exception $e ) |
|
| 28 | +} catch ( Exception $e ) |
|
| 30 | 29 | { |
| 31 | 30 | echo $e; |
| 32 | 31 | } |
| 33 | 32 | \ No newline at end of file |
@@ -6,26 +6,26 @@ discard block |
||
| 6 | 6 | * @author Pedro Alarcao <[email protected]> |
| 7 | 7 | */ |
| 8 | 8 | |
| 9 | -if ( ! ini_get ( 'short_open_tag' ) ) |
|
| 9 | +if ( ! ini_get('short_open_tag')) |
|
| 10 | 10 | { |
| 11 | - die( "please enable short_open_tag directive in php.ini\n" ); |
|
| 11 | + die("please enable short_open_tag directive in php.ini\n"); |
|
| 12 | 12 | } |
| 13 | 13 | |
| 14 | -if ( ! ini_get ( 'register_argc_argv' ) ) |
|
| 14 | +if ( ! ini_get('register_argc_argv')) |
|
| 15 | 15 | { |
| 16 | - die( "please enable register_argc_argv directive in php.ini\n" ); |
|
| 16 | + die("please enable register_argc_argv directive in php.ini\n"); |
|
| 17 | 17 | } |
| 18 | 18 | |
| 19 | 19 | |
| 20 | -if ( function_exists ( 'ini_set' ) ) |
|
| 20 | +if (function_exists('ini_set')) |
|
| 21 | 21 | { |
| 22 | - @ini_set ( 'display_errors' , 1 ); |
|
| 22 | + @ini_set('display_errors', 1); |
|
| 23 | 23 | |
| 24 | - $memoryInBytes = function ( $value ) |
|
| 24 | + $memoryInBytes = function($value) |
|
| 25 | 25 | { |
| 26 | - $unit = strtolower ( substr ( $value , - 1 , 1 ) ); |
|
| 26 | + $unit = strtolower(substr($value, - 1, 1)); |
|
| 27 | 27 | $value = (int) $value; |
| 28 | - switch ( $unit ) |
|
| 28 | + switch ($unit) |
|
| 29 | 29 | { |
| 30 | 30 | case 'g': |
| 31 | 31 | $value *= 1024; |
@@ -40,21 +40,21 @@ discard block |
||
| 40 | 40 | return $value; |
| 41 | 41 | }; |
| 42 | 42 | |
| 43 | - $memoryLimit = trim ( ini_get ( 'memory_limit' ) ); |
|
| 43 | + $memoryLimit = trim(ini_get('memory_limit')); |
|
| 44 | 44 | // Increase memory_limit if it is lower than 1GB |
| 45 | - if ( $memoryLimit != - 1 && $memoryInBytes( $memoryLimit ) < 1024 * 1024 * 1024 ) |
|
| 45 | + if ($memoryLimit != - 1 && $memoryInBytes($memoryLimit) < 1024 * 1024 * 1024) |
|
| 46 | 46 | { |
| 47 | - @ini_set ( 'memory_limit' , '1G' ); |
|
| 47 | + @ini_set('memory_limit', '1G'); |
|
| 48 | 48 | } |
| 49 | - unset( $memoryInBytes , $memoryLimit ); |
|
| 49 | + unset($memoryInBytes, $memoryLimit); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | -set_include_path ( |
|
| 53 | - implode ( |
|
| 54 | - PATH_SEPARATOR , |
|
| 55 | - array ( |
|
| 56 | - realpath ( dirname ( __FILE__ ) . "/build/" ) , |
|
| 57 | - get_include_path () , |
|
| 52 | +set_include_path( |
|
| 53 | + implode( |
|
| 54 | + PATH_SEPARATOR, |
|
| 55 | + array( |
|
| 56 | + realpath(dirname(__FILE__) . "/build/"), |
|
| 57 | + get_include_path(), |
|
| 58 | 58 | ) |
| 59 | 59 | ) |
| 60 | 60 | ); |
@@ -65,34 +65,34 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | try |
| 67 | 67 | { |
| 68 | - $arrValid = array ( |
|
| 69 | - 'version' , |
|
| 70 | - 'help' , |
|
| 71 | - 'status' , |
|
| 72 | - 'init' , |
|
| 73 | - 'config-env:' , |
|
| 74 | - 'config-ini:' , |
|
| 75 | - 'database:' , |
|
| 76 | - 'schema:' , |
|
| 77 | - 'driver:' , |
|
| 78 | - 'framework:' , |
|
| 68 | + $arrValid = array( |
|
| 69 | + 'version', |
|
| 70 | + 'help', |
|
| 71 | + 'status', |
|
| 72 | + 'init', |
|
| 73 | + 'config-env:', |
|
| 74 | + 'config-ini:', |
|
| 75 | + 'database:', |
|
| 76 | + 'schema:', |
|
| 77 | + 'driver:', |
|
| 78 | + 'framework:', |
|
| 79 | 79 | 'path:' |
| 80 | 80 | ); |
| 81 | 81 | |
| 82 | - $_path = realpath ( __FILE__ ); |
|
| 83 | - $argv = getopt ( null , $arrValid ); |
|
| 82 | + $_path = realpath(__FILE__); |
|
| 83 | + $argv = getopt(null, $arrValid); |
|
| 84 | 84 | |
| 85 | - if ( array_key_exists ( 'init' , $argv ) ) |
|
| 85 | + if (array_key_exists('init', $argv)) |
|
| 86 | 86 | { |
| 87 | - $maker = new \Classes\MakerConfigFile( $argv , $_path ); |
|
| 87 | + $maker = new \Classes\MakerConfigFile($argv, $_path); |
|
| 88 | 88 | } else |
| 89 | 89 | { |
| 90 | - $maker = new \Classes\MakerFile( new \Classes\Config( $argv , $_path ) ); |
|
| 90 | + $maker = new \Classes\MakerFile(new \Classes\Config($argv, $_path)); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $maker->run (); |
|
| 93 | + $maker->run(); |
|
| 94 | 94 | |
| 95 | -} catch ( \Exception $e ) |
|
| 95 | +} catch (\Exception $e) |
|
| 96 | 96 | { |
| 97 | - die( $e->getMessage () ); |
|
| 97 | + die($e->getMessage()); |
|
| 98 | 98 | } |
@@ -3,15 +3,15 @@ |
||
| 3 | 3 | /** |
| 4 | 4 | * Application Entity |
| 5 | 5 | * |
| 6 | - * <?=$this->config->last_modify."\n"?> |
|
| 6 | + * <?=$this->config->last_modify . "\n"?> |
|
| 7 | 7 | * |
| 8 | 8 | * @package <?=$this->config->namespace?>Model |
| 9 | 9 | * @subpackage Model |
| 10 | - * @author <?=$this->config->author."\n"?> |
|
| 10 | + * @author <?=$this->config->author . "\n"?> |
|
| 11 | 11 | * |
| 12 | - * @copyright <?=$this->config->copyright."\n"?> |
|
| 13 | - * @license <?=$this->config->license."\n"?> |
|
| 14 | - * @link <?=$this->config->link."\n"?> |
|
| 12 | + * @copyright <?=$this->config->copyright . "\n"?> |
|
| 13 | + * @license <?=$this->config->license . "\n"?> |
|
| 14 | + * @link <?=$this->config->link . "\n"?> |
|
| 15 | 15 | */ |
| 16 | 16 | |
| 17 | 17 | abstract class <?=$this->config->namespace?>Model_EntityAbstract extends Zend_Db_Table_Row_Abstract |
@@ -178,14 +178,14 @@ |
||
| 178 | 178 | public function createDependece ( $constraint_name , $table_name , $column_name , $schema = null ) |
| 179 | 179 | { |
| 180 | 180 | $objConstrantDependence = Constrant::getInstance () |
| 181 | - ->populate ( |
|
| 182 | - array ( |
|
| 183 | - 'constrant' => $constraint_name , |
|
| 184 | - 'schema' => $schema , |
|
| 185 | - 'table' => $table_name , |
|
| 186 | - 'column' => $column_name |
|
| 187 | - ) |
|
| 188 | - ); |
|
| 181 | + ->populate ( |
|
| 182 | + array ( |
|
| 183 | + 'constrant' => $constraint_name , |
|
| 184 | + 'schema' => $schema , |
|
| 185 | + 'table' => $table_name , |
|
| 186 | + 'column' => $column_name |
|
| 187 | + ) |
|
| 188 | + ); |
|
| 189 | 189 | |
| 190 | 190 | $this->addDependece ( $objConstrantDependence ); |
| 191 | 191 | |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * |
| 17 | 17 | * @author Pedro Alarcao <[email protected]> |
| 18 | 18 | */ |
| 19 | - final private function __construct () |
|
| 19 | + final private function __construct() |
|
| 20 | 20 | { |
| 21 | 21 | } |
| 22 | 22 | |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | * |
| 26 | 26 | * @return \Classes\Db\Column |
| 27 | 27 | */ |
| 28 | - public static function getInstance () |
|
| 28 | + public static function getInstance() |
|
| 29 | 29 | { |
| 30 | 30 | return new Column(); |
| 31 | 31 | } |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | /** |
| 79 | 79 | * @return string |
| 80 | 80 | */ |
| 81 | - public function getName () |
|
| 81 | + public function getName() |
|
| 82 | 82 | { |
| 83 | 83 | return $this->name; |
| 84 | 84 | } |
@@ -88,12 +88,12 @@ discard block |
||
| 88 | 88 | * |
| 89 | 89 | * @param $array |
| 90 | 90 | */ |
| 91 | - public function populate ( $array ) |
|
| 91 | + public function populate($array) |
|
| 92 | 92 | { |
| 93 | - $this->name = $array[ 'name' ]; |
|
| 94 | - $this->type = $array[ 'type' ]; |
|
| 95 | - $this->nullable = $array[ 'nullable' ]; |
|
| 96 | - $this->max_length = $array[ 'max_length' ]; |
|
| 93 | + $this->name = $array['name']; |
|
| 94 | + $this->type = $array['type']; |
|
| 95 | + $this->nullable = $array['nullable']; |
|
| 96 | + $this->max_length = $array['max_length']; |
|
| 97 | 97 | |
| 98 | 98 | return $this; |
| 99 | 99 | } |
@@ -101,31 +101,31 @@ discard block |
||
| 101 | 101 | /** |
| 102 | 102 | * @return boolean |
| 103 | 103 | */ |
| 104 | - public function isPrimaryKey () |
|
| 104 | + public function isPrimaryKey() |
|
| 105 | 105 | { |
| 106 | - return ! empty( $this->primarykey ); |
|
| 106 | + return ! empty($this->primarykey); |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
| 110 | 110 | * @return boolean |
| 111 | 111 | */ |
| 112 | - public function isForeingkey () |
|
| 112 | + public function isForeingkey() |
|
| 113 | 113 | { |
| 114 | - return ! empty( $this->refForeingkey ); |
|
| 114 | + return ! empty($this->refForeingkey); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
| 118 | 118 | * @return boolean |
| 119 | 119 | */ |
| 120 | - public function hasDependence () |
|
| 120 | + public function hasDependence() |
|
| 121 | 121 | { |
| 122 | - return ! empty( $this->dependences ); |
|
| 122 | + return ! empty($this->dependences); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | /** |
| 126 | 126 | * @return string |
| 127 | 127 | */ |
| 128 | - public function getType () |
|
| 128 | + public function getType() |
|
| 129 | 129 | { |
| 130 | 130 | return $this->type; |
| 131 | 131 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | /** |
| 134 | 134 | * @return string |
| 135 | 135 | */ |
| 136 | - public function getComment () |
|
| 136 | + public function getComment() |
|
| 137 | 137 | { |
| 138 | 138 | return $this->comment; |
| 139 | 139 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | /** |
| 142 | 142 | * @param string $comment |
| 143 | 143 | */ |
| 144 | - public function setComment ( $comment ) |
|
| 144 | + public function setComment($comment) |
|
| 145 | 145 | { |
| 146 | 146 | $this->comment = $comment; |
| 147 | 147 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | /** |
| 152 | 152 | * @param \Classes\Db\Constrant $primarykey |
| 153 | 153 | */ |
| 154 | - public function setPrimaryKey ( Constrant $primarykey ) |
|
| 154 | + public function setPrimaryKey(Constrant $primarykey) |
|
| 155 | 155 | { |
| 156 | 156 | $this->primarykey = $primarykey; |
| 157 | 157 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | /** |
| 162 | 162 | * @param \Classes\Db\Constrant $dependece |
| 163 | 163 | */ |
| 164 | - public function addDependece ( Constrant $dependece ) |
|
| 164 | + public function addDependece(Constrant $dependece) |
|
| 165 | 165 | { |
| 166 | 166 | $this->dependences[] = $dependece; |
| 167 | 167 | |
@@ -175,19 +175,19 @@ discard block |
||
| 175 | 175 | * |
| 176 | 176 | * @return $this |
| 177 | 177 | */ |
| 178 | - public function createDependece ( $constraint_name , $table_name , $column_name , $schema = null ) |
|
| 178 | + public function createDependece($constraint_name, $table_name, $column_name, $schema = null) |
|
| 179 | 179 | { |
| 180 | - $objConstrantDependence = Constrant::getInstance () |
|
| 181 | - ->populate ( |
|
| 182 | - array ( |
|
| 183 | - 'constrant' => $constraint_name , |
|
| 184 | - 'schema' => $schema , |
|
| 185 | - 'table' => $table_name , |
|
| 180 | + $objConstrantDependence = Constrant::getInstance() |
|
| 181 | + ->populate( |
|
| 182 | + array( |
|
| 183 | + 'constrant' => $constraint_name, |
|
| 184 | + 'schema' => $schema, |
|
| 185 | + 'table' => $table_name, |
|
| 186 | 186 | 'column' => $column_name |
| 187 | 187 | ) |
| 188 | 188 | ); |
| 189 | 189 | |
| 190 | - $this->addDependece ( $objConstrantDependence ); |
|
| 190 | + $this->addDependece($objConstrantDependence); |
|
| 191 | 191 | |
| 192 | 192 | return $this; |
| 193 | 193 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | /** |
| 196 | 196 | * @param \Classes\Db\Constrant $reference |
| 197 | 197 | */ |
| 198 | - public function addRefFk ( Constrant $reference ) |
|
| 198 | + public function addRefFk(Constrant $reference) |
|
| 199 | 199 | { |
| 200 | 200 | $this->refForeingkey = $reference; |
| 201 | 201 | |
@@ -207,7 +207,7 @@ discard block |
||
| 207 | 207 | * |
| 208 | 208 | * @return \Classes\Db\Constrant |
| 209 | 209 | */ |
| 210 | - public function getFks () |
|
| 210 | + public function getFks() |
|
| 211 | 211 | { |
| 212 | 212 | return $this->refForeingkey; |
| 213 | 213 | } |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * |
| 218 | 218 | * @return \Classes\Db\Constrant[] |
| 219 | 219 | */ |
| 220 | - public function getDependences () |
|
| 220 | + public function getDependences() |
|
| 221 | 221 | { |
| 222 | 222 | return $this->dependences; |
| 223 | 223 | } |
@@ -225,9 +225,9 @@ discard block |
||
| 225 | 225 | /** |
| 226 | 226 | * @return bool |
| 227 | 227 | */ |
| 228 | - public function hasDependences () |
|
| 228 | + public function hasDependences() |
|
| 229 | 229 | { |
| 230 | - return (bool) count ( $this->dependences ); |
|
| 230 | + return (bool) count($this->dependences); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -235,7 +235,7 @@ discard block |
||
| 235 | 235 | * |
| 236 | 236 | * @return \Classes\Db\Constrant[] |
| 237 | 237 | */ |
| 238 | - public function getPrimaryKey () |
|
| 238 | + public function getPrimaryKey() |
|
| 239 | 239 | { |
| 240 | 240 | return $this->primarykey; |
| 241 | 241 | } |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | /** |
| 244 | 244 | * |
| 245 | 245 | */ |
| 246 | - public function getMaxLength () |
|
| 246 | + public function getMaxLength() |
|
| 247 | 247 | { |
| 248 | 248 | return $this->max_length; |
| 249 | 249 | } |
@@ -251,7 +251,7 @@ discard block |
||
| 251 | 251 | /** |
| 252 | 252 | * @return bool |
| 253 | 253 | */ |
| 254 | - public function hasSequence () |
|
| 254 | + public function hasSequence() |
|
| 255 | 255 | { |
| 256 | 256 | return (bool) $this->sequence; |
| 257 | 257 | } |
@@ -259,7 +259,7 @@ discard block |
||
| 259 | 259 | /** |
| 260 | 260 | * @return string |
| 261 | 261 | */ |
| 262 | - public function getSequence () |
|
| 262 | + public function getSequence() |
|
| 263 | 263 | { |
| 264 | 264 | return $this->sequence; |
| 265 | 265 | } |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | /** |
| 268 | 268 | * @param string $sequence |
| 269 | 269 | */ |
| 270 | - public function setSequence ( $sequence ) |
|
| 270 | + public function setSequence($sequence) |
|
| 271 | 271 | { |
| 272 | 272 | $this->sequence = $sequence; |
| 273 | 273 | } |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | /** |
| 276 | 276 | * @return boolean |
| 277 | 277 | */ |
| 278 | - public function isNullable () |
|
| 278 | + public function isNullable() |
|
| 279 | 279 | { |
| 280 | 280 | return $this->nullable; |
| 281 | 281 | } |
@@ -21,11 +21,11 @@ discard block |
||
| 21 | 21 | * |
| 22 | 22 | * @author Pedro Alarcao <[email protected]> |
| 23 | 23 | */ |
| 24 | - final private function __construct () |
|
| 24 | + final private function __construct() |
|
| 25 | 25 | { |
| 26 | 26 | } |
| 27 | 27 | |
| 28 | - public static function getInstance () |
|
| 28 | + public static function getInstance() |
|
| 29 | 29 | { |
| 30 | 30 | return new self(); |
| 31 | 31 | } |
@@ -55,31 +55,31 @@ discard block |
||
| 55 | 55 | * |
| 56 | 56 | * @return Constrant |
| 57 | 57 | */ |
| 58 | - public function populate ( $array ) |
|
| 58 | + public function populate($array) |
|
| 59 | 59 | { |
| 60 | - if ( isset( $array[ 'schema' ] ) ) |
|
| 60 | + if (isset($array['schema'])) |
|
| 61 | 61 | { |
| 62 | - $this->schema = $array[ 'schema' ]; |
|
| 62 | + $this->schema = $array['schema']; |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | - $this->constrant = $array[ 'constrant' ]; |
|
| 66 | - $this->table = $array[ 'table' ]; |
|
| 67 | - $this->column = $array[ 'column' ]; |
|
| 65 | + $this->constrant = $array['constrant']; |
|
| 66 | + $this->table = $array['table']; |
|
| 67 | + $this->column = $array['column']; |
|
| 68 | 68 | |
| 69 | 69 | return $this; |
| 70 | 70 | } |
| 71 | 71 | |
| 72 | - public function getDatabase (){ } |
|
| 72 | + public function getDatabase() { } |
|
| 73 | 73 | |
| 74 | 74 | /** |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | - public function getNameConstrant () |
|
| 77 | + public function getNameConstrant() |
|
| 78 | 78 | { |
| 79 | 79 | return $this->constrant; |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - public function hasSchema () |
|
| 82 | + public function hasSchema() |
|
| 83 | 83 | { |
| 84 | 84 | return (bool) $this->schema; |
| 85 | 85 | } |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | /** |
| 88 | 88 | * @return string |
| 89 | 89 | */ |
| 90 | - public function getSchema () |
|
| 90 | + public function getSchema() |
|
| 91 | 91 | { |
| 92 | 92 | return $this->schema; |
| 93 | 93 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | /** |
| 96 | 96 | * @return string |
| 97 | 97 | */ |
| 98 | - public function getTable () |
|
| 98 | + public function getTable() |
|
| 99 | 99 | { |
| 100 | 100 | return $this->table; |
| 101 | 101 | } |
@@ -103,7 +103,7 @@ discard block |
||
| 103 | 103 | /** |
| 104 | 104 | * @return string |
| 105 | 105 | */ |
| 106 | - public function getColumn () |
|
| 106 | + public function getColumn() |
|
| 107 | 107 | { |
| 108 | 108 | return $this->column; |
| 109 | 109 | } |