Skip to content

Commit

Permalink
reformatted code and used PHP_EOL
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Wawrzyniak committed Aug 3, 2012
1 parent 36224bf commit 9ad7293
Show file tree
Hide file tree
Showing 9 changed files with 96 additions and 62 deletions.
11 changes: 4 additions & 7 deletions phalcon.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,16 @@

if(!isset($_SERVER['argv'][1]) || $_SERVER['argv'][1]=='commands'){
echo
'|----------------------'.
"\n\r".
'|-- Available commands:' .
"\r\n".
'|----------------------'.
PHP_EOL;
'|----------------------' . PHP_EOL .
'|-- Available commands:' . PHP_EOL .
'|----------------------' . PHP_EOL ;

$directory = new DirectoryIterator($phalconToolsPath."scripts");
foreach($directory as $file){
if(!$file->isDir()){
$command = str_replace('.php', '', $file->getFileName());
$command = str_replace('_', '-', $command);
echo '- ' . $command, PHP_EOL;
echo '- ' . $command . PHP_EOL;
}
}
} else {
Expand Down
17 changes: 11 additions & 6 deletions scripts/all_models.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,17 @@ public function run(){

if (isset($parameters[1]) && $parameters[1] == '?'){
echo
"------------------
\r|-- Example\n\r|-- phalcon all-models --schema=my --get-set --doc --relations --trace
\r|-----------------\r\n|-- Usage \n\r|-- phalcon all-models [options]
\r|-----------------\n\r|-- Options:\n\r------------------\n\r
\r";
echo join("\n", $posibleParameters) . "\n";
"------------------" . PHP_EOL .
"|-- Example" . PHP_EOL .
"|-- phalcon all-models --schema=my --get-set --doc --relations --trace" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Usage ". PHP_EOL .
"|-- phalcon all-models [options]" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Options:". PHP_EOL .
"------------------" . PHP_EOL;

echo join(PHP_EOL, $posibleParameters) . PHP_EOL;
return;
}

Expand Down
17 changes: 11 additions & 6 deletions scripts/controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,17 @@ public function __construct(){

if (!isset($parameters[1]) || $parameters[1] == '?'){
echo
"------------------
\r|-- Example\n\r|-- phalcon controller User --force
\r|-----------------\r\n|-- Usage \n\r|-- phalcon [controller name] [options]
\r|-----------------\n\r|-- Options:\n\r------------------\n\r
\r";
echo join("\n\r", $posibleParameters) . "\n";
"------------------" . PHP_EOL .
"|-- Example" . PHP_EOL .
"|-- phalcon controller User --force" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Usage " . PHP_EOL .
"|-- phalcon [controller name] [options]" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Options:" . PHP_EOL .
"------------------" . PHP_EOL ;

echo join(PHP_EOL, $posibleParameters) . PHP_EOL;
return;
}

Expand Down
18 changes: 12 additions & 6 deletions scripts/migrate.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,18 @@ public function __construct(){
$parameters = $this->getParameters();
if (isset($parameters[1]) && $parameters[1] == '?'){
echo
"------------------
\r|-- Example\n\r|-- phalcon migrate --version 201109311921 --table users
\r|-----------------\r\n|-- Usage \n\r|-- phalcon migrate [options]
\r|-----------------\n\r|-- Options:\n\r------------------\n\r
\r";
echo join("\n", $posibleParameters) . "\n";
"------------------" . PHP_EOL .
"|-- Example" . PHP_EOL .
"|-- phalcon migrate --version 201109311921 --table users" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Usage" . PHP_EOL .
"|-- phalcon migrate [options]" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Options:" . PHP_EOL .
"------------------" . PHP_EOL ;


echo join(PHP_EOL, $posibleParameters) . PHP_EOL;
return;
}

Expand Down
17 changes: 10 additions & 7 deletions scripts/migration.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,20 +55,23 @@ public function __construct(){
'data=s' => "--data \t\tExport table data. Type: always,on-create.",
'verbose' => "--verbose \tGenerate profiling of SQL statements sent to database.",
'force' => "--force \tForces to overwrite existing migrations.",
//'help' => "--help \t\t\tShows this help"
);

$this->parseParameters($posibleParameters);

$parameters = $this->getParameters();
if (isset($parameters[1]) && $parameters[1] == '?'){
echo
"------------------
\r|-- Example\n\r|-- phalcon migration --data --verbose
\r|-----------------\r\n|-- Usage \n\r|-- phalcon migration [options]
\r|-----------------\n\r|-- Options:\n\r------------------\n\r
\r";
echo join("\n", $posibleParameters) . "\n";
"------------------" . PHP_EOL .
"|-- Example" . PHP_EOL .
"|-- phalcon migration --data --verbose" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Usage" . PHP_EOL .
"|-- phalcon migration [options]" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Options:" . PHP_EOL .
"------------------" . PHP_EOL ;
echo join(PHP_EOL, $posibleParameters) . PHP_EOL;
return;
}

Expand Down
18 changes: 12 additions & 6 deletions scripts/model.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,18 @@ public function run(){

if (!isset($parameters[1]) || $parameters[1] == '?'){
echo
"------------------
\r|-- Example\n\r|-- phalcon model User users --schema=my --get-set --doc --force --trace
\r|-----------------\r\n|-- Usage \n\r|-- phalcon model [className] [tableName] [options]
\r|-----------------\n\r|-- Options:\n\r------------------\n\r
\r";
echo join("\n", $posibleParameters) . "\n";
"------------------" . PHP_EOL .
"|-- Example" . PHP_EOL .
"|-- phalcon model User users --schema=my --get-set --doc --force --trace" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Usage " . PHP_EOL .
"|-- phalcon model [className] [tableName] [options] " . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Options:" . PHP_EOL .
"------------------" . PHP_EOL . PHP_EOL;


echo join(PHP_EOL, $posibleParameters) . PHP_EOL;
return;
}

Expand Down
10 changes: 5 additions & 5 deletions scripts/project.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,11 @@ public function __construct(){

public function run(){
$helpText =
"------------------
\r|-- Usage \n\r|-- phalcon project ? \t\t\t\t\t Shows this help text\r
\r|-- phalcon project [name] [directory] [enable-webtools] Creates a project
\r|-----------------\n\r
";
"------------------" . PHP_EOL .
"|-- Usage " . PHP_EOL .
"|-- phalcon project ? \t\t\t\t\t Shows this help text" . PHP_EOL .
"|-- phalcon project [name] [directory] [enable-webtools] Creates a project" . PHP_EOL .
"|-----------------" . PHP_EOL ;


$posibleParameters = array(
Expand Down
18 changes: 12 additions & 6 deletions scripts/scaffold.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,18 @@ public function run(){

if (!isset($parameters[1]) || $parameters[1] == '?'){
echo
"------------------
\r|-- Example\n\r|-- phalcon scaffold users --autocomplete=login
\r|-----------------\r\n|-- Usage \n\r|-- phalcon scaffold [table name] [options]
\r|-----------------\n\r|-- Options:\n\r------------------\n\r
\r";
echo join("\n\r", $posibleParameters) . "\n";
"------------------ " . PHP_EOL .
"|-- Example" . PHP_EOL .
"|-- phalcon scaffold users --autocomplete=login" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Usage" . PHP_EOL .
"|-- phalcon scaffold [table name] [options]" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Options:" . PHP_EOL .
"------------------" . PHP_EOL . PHP_EOL;


echo join(PHP_EOL, $posibleParameters) . PHP_EOL;
return;
}

Expand Down
32 changes: 19 additions & 13 deletions scripts/scaffold_bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,12 +61,17 @@ public function run(){

if (!isset($parameters[1]) || $parameters[1] == '?'){
echo
"------------------
\r|-- Example\n\r|-- phalcon scaffold-bootstrap users --autocomplete=login
\r|-----------------\r\n|-- Usage \n\r|-- phalcon scaffold-bootstrap [table name] [options]
\r|-----------------\n\r|-- Options:\n\r------------------\n\r
\r";
echo join("\n\r", $posibleParameters) . "\n";
"------------------" . PHP_EOL .
"|-- Example" . PHP_EOL .
"|-- phalcon scaffold-bootstrap users --autocomplete=login" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Usage" . PHP_EOL .
"|-- phalcon scaffold-bootstrap [table name] [options]" . PHP_EOL .
"|-----------------" . PHP_EOL .
"|-- Options: " . PHP_EOL .
"------------------" . PHP_EOL . PHP_EOL;

echo join(PHP_EOL, $posibleParameters) . PHP_EOL;
return;
}

Expand All @@ -93,15 +98,16 @@ public function run(){
$scaffoldBuilder->build();

$head =
'<link rel="stylesheet" href="'.$path.'public/css/bootstrap/bootstrap.min.css" type="text/css" />'. "\n".
'<script type="text/javascript" src="'.$path.'public/javascript/bootstrap/bootstrap.min.js'.'"></script>';
'<link rel="stylesheet" href="' . $path . 'public/css/bootstrap/bootstrap.min.css" type="text/css" />' . PHP_EOL.
'<script type="text/javascript" src="' . $path . 'public/javascript/bootstrap/bootstrap.min.js' . '"></script>';

echo
"Twitter bootstrap scaffolding generated.
\rRemember to put the contents of head.remove-me.html file in the <head> of your layout.
\rhead.html:\r\n\r\n---------------------\r\n" .
$head .
"\n\n---------------------\r\n";
"Twitter bootstrap scaffolding generated." . PHP_EOL .
"Remember to put the contents of head.remove-me.html file in the <head> of your layout." . PHP_EOL .
"head.html:" . PHP_EOL .
"---------------------" . PHP_EOL .
$head . PHP_EOL .
"---------------------" . PHP_EOL;

file_put_contents($this->getOption('directory') .'/head.remove-me.html', $head);
}
Expand Down

0 comments on commit 9ad7293

Please sign in to comment.