@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | |
3 | -function getEntityRepository($content){ |
|
3 | +function getEntityRepository($content) { |
|
4 | 4 | return getArgumentOfKeyword($content, 'use'); |
5 | 5 | } |
6 | 6 | |
@@ -9,27 +9,27 @@ discard block |
||
9 | 9 | return getArgumentOfKeyword($content, 'namespace'); |
10 | 10 | } |
11 | 11 | |
12 | -function getEntityXYRepository($content){ |
|
12 | +function getEntityXYRepository($content) { |
|
13 | 13 | $fcerX = getEntityRepository($content, 'use'); |
14 | 14 | $pos = strpos($content, $fcerX); |
15 | 15 | $fcerY = getEntityRepository(substr($content, $pos+strlen($fcerX)), 'use'); |
16 | 16 | return [$fcerX, $fcerY]; |
17 | 17 | } |
18 | 18 | |
19 | -function getArgumentOfKeyword($content, $keyword){ |
|
20 | - if( ($pos = strpos($content, $keyword.' ')) === false ) { |
|
21 | - echo $keyword.' not found'."\n"; |
|
19 | +function getArgumentOfKeyword($content, $keyword) { |
|
20 | + if (($pos = strpos($content, $keyword . ' ')) === false) { |
|
21 | + echo $keyword . ' not found' . "\n"; |
|
22 | 22 | exit(2); |
23 | 23 | } |
24 | 24 | $vendor = $pos+strlen($keyword)+1; |
25 | 25 | |
26 | - if( ($pos = strpos($content, '\\', $pos)) === false ) { |
|
27 | - echo $keyword.' has no backslash'."\n"; |
|
26 | + if (($pos = strpos($content, '\\', $pos)) === false) { |
|
27 | + echo $keyword . ' has no backslash' . "\n"; |
|
28 | 28 | exit(3); |
29 | 29 | } |
30 | 30 | |
31 | - if( ($end = strpos($content, ';', $pos)) === false ) { |
|
32 | - echo $keyword.' does not end in ;'."\n"; |
|
31 | + if (($end = strpos($content, ';', $pos)) === false) { |
|
32 | + echo $keyword . ' does not end in ;' . "\n"; |
|
33 | 33 | exit(4); |
34 | 34 | } |
35 | 35 | |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | } |
38 | 38 | |
39 | 39 | // TODO rename namespace2pathVendorStripped |
40 | -function namespace2dir($namespace){ |
|
40 | +function namespace2dir($namespace) { |
|
41 | 41 | $pos = strpos($namespace, '\\'); |
42 | 42 | $vs = substr($namespace, $pos); |
43 | 43 | return str_replace('\\', '/', $vs); // DIRECTORY_SEPARATOR |
@@ -50,9 +50,9 @@ discard block |
||
50 | 50 | $file = array_pop($parts); |
51 | 51 | $dir = ''; |
52 | 52 | foreach ($parts as $part) { |
53 | - if (!is_dir($dir .= "$part/")) mkdir($dir); |
|
53 | + if ( ! is_dir($dir .= "$part/")) mkdir($dir); |
|
54 | 54 | } |
55 | - if( is_file($destination) ){ |
|
55 | + if (is_file($destination)) { |
|
56 | 56 | rename($destination, $destination . '.bak'); |
57 | 57 | } |
58 | 58 | return file_put_contents($destination, $contents); |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $resource_dir = 'resource/'; |
8 | 8 | $resource_file = 'UseCaseEntityBus.tpl'; |
9 | 9 | |
10 | -if( $argc != 4){ |
|
10 | +if ($argc != 4) { |
|
11 | 11 | echo "Usage:\n"; |
12 | 12 | echo "php tools/makeUseCaseEntity.php UseCase Entity fields,...\n"; |
13 | 13 | exit(1); |
@@ -23,9 +23,9 @@ discard block |
||
23 | 23 | |
24 | 24 | $template = file_get_contents($resource_dir . $resource_file); |
25 | 25 | |
26 | -if( DEBUG ){echo "Template:\n";echo $template;} |
|
26 | +if (DEBUG) {echo "Template:\n"; echo $template; } |
|
27 | 27 | |
28 | -if( $usecase === 'read' ){ |
|
28 | +if ($usecase === 'read') { |
|
29 | 29 | $use_entity_if_read = 'use ProyectoTAU\TAU\Module\Administration\%Entity%\Domain\%Entity%;'; // TODO vendor & fcns must be in template only |
30 | 30 | $next = str_replace('%use_entity_if_read%', $use_entity_if_read, $template); |
31 | 31 | $return_entity_if_read = ': %Entity%'; |
@@ -35,24 +35,24 @@ discard block |
||
35 | 35 | $use_entity_if_read = ''; |
36 | 36 | $next = str_replace('%use_entity_if_read%', '', $template); |
37 | 37 | $next = str_replace('%return_entity_if_read%', '', $next); |
38 | - $next = str_replace('%return_if_read%'.' ', '', $next); |
|
38 | + $next = str_replace('%return_if_read%' . ' ', '', $next); |
|
39 | 39 | } |
40 | 40 | |
41 | -if( DEBUG ){echo "next: %use_entity_if_read% => $use_entity_if_read\n";echo $next;} |
|
41 | +if (DEBUG) {echo "next: %use_entity_if_read% => $use_entity_if_read\n"; echo $next; } |
|
42 | 42 | |
43 | 43 | $next = str_replace('%usecase%', $usecase, $next); |
44 | 44 | $next = str_replace('%Usecase%', $UseCase, $next); |
45 | 45 | |
46 | -if( DEBUG ){echo "next: %usecase%/%Usecase% => $usecase/$UseCase\n";echo $next;} |
|
46 | +if (DEBUG) {echo "next: %usecase%/%Usecase% => $usecase/$UseCase\n"; echo $next; } |
|
47 | 47 | |
48 | -$next = str_replace('%entity%', $entity,$next); |
|
48 | +$next = str_replace('%entity%', $entity, $next); |
|
49 | 49 | $next = str_replace('%Entity%', $Entity, $next); |
50 | 50 | |
51 | -if( DEBUG ){echo "next: %entity%/%Entity% => $entity/$Entity\n";echo $next;} |
|
51 | +if (DEBUG) {echo "next: %entity%/%Entity% => $entity/$Entity\n"; echo $next; } |
|
52 | 52 | |
53 | 53 | $next = str_replace('%fields%', $argv[3], $next); |
54 | 54 | |
55 | -if( DEBUG ){echo "next: %fields% => $argv[3]\n";echo $next;} |
|
55 | +if (DEBUG) {echo "next: %fields% => $argv[3]\n"; echo $next; } |
|
56 | 56 | |
57 | 57 | $fcns = getNamespace($next); |
58 | 58 | $next = str_replace('%fcns%', $fcns, $next); |
@@ -60,13 +60,13 @@ discard block |
||
60 | 60 | $fcer = getEntityRepository($next); |
61 | 61 | $next = str_replace('%fcer%', $fcer, $next); |
62 | 62 | |
63 | -if( DEBUG ){echo "next:\n%fcns% => $fcns\n%fcer% => $fcer\n";echo $next;} |
|
63 | +if (DEBUG) {echo "next:\n%fcns% => $fcns\n%fcer% => $fcer\n"; echo $next; } |
|
64 | 64 | |
65 | 65 | $pa = ""; |
66 | 66 | $aa = ""; |
67 | -foreach ($public_field_attributes as $field){ |
|
67 | +foreach ($public_field_attributes as $field) { |
|
68 | 68 | $pa .= '$' . $field . ', '; |
69 | - $aa .= INDENT . INDENT . INDENT . INDENT . |
|
69 | + $aa .= INDENT . INDENT . INDENT . INDENT . |
|
70 | 70 | "'" . $field . "' => \$" . $field . ",\n"; |
71 | 71 | } |
72 | 72 | $pa = substr($pa, 0, strlen($pa)-2); // strip trailing , and space |
@@ -75,12 +75,12 @@ discard block |
||
75 | 75 | $next = str_replace('%param_attributes%', $pa, $next); |
76 | 76 | $next = str_replace('%array_attributes%', $aa, $next); |
77 | 77 | |
78 | -if( DEBUG ){echo "result:\n";} |
|
78 | +if (DEBUG) {echo "result:\n"; } |
|
79 | 79 | echo $next; |
80 | 80 | |
81 | 81 | $destination = 'src' . namespace2dir($fcns) . '/' . $UseCase . $Entity . '.php'; |
82 | 82 | |
83 | -if( ($count = file_force_contents($destination, $next)) === false ){ |
|
83 | +if (($count = file_force_contents($destination, $next)) === false) { |
|
84 | 84 | echo 'file_put_contents returned false'; |
85 | 85 | } else { |
86 | 86 | echo $destination . ': ' . $count . ' bytes written'; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $resource_dir = 'resource/'; |
8 | 8 | $resource_file = 'UseCaseEntityCommand.tpl'; |
9 | 9 | |
10 | -if( $argc != 4){ |
|
10 | +if ($argc != 4) { |
|
11 | 11 | echo "Usage:\n"; |
12 | 12 | echo "php tools/makeUseCaseEntityCommand.php UseCase Entity fields,...\n"; |
13 | 13 | exit(1); |
@@ -22,50 +22,50 @@ discard block |
||
22 | 22 | |
23 | 23 | $template = file_get_contents($resource_dir . $resource_file); |
24 | 24 | |
25 | -if( DEBUG ){echo 'Template';echo $template;} |
|
25 | +if (DEBUG) {echo 'Template'; echo $template; } |
|
26 | 26 | |
27 | 27 | $next = str_replace('%usecase%', $usecase, $template); |
28 | 28 | $next = str_replace('%Usecase%', $UseCase, $next); |
29 | 29 | |
30 | -if( DEBUG ){echo 'next';echo $next;} |
|
30 | +if (DEBUG) {echo 'next'; echo $next; } |
|
31 | 31 | |
32 | 32 | $next = str_replace('%Entity%', $Entity, $next); |
33 | 33 | |
34 | -if( DEBUG ){echo 'next';echo $next;} |
|
34 | +if (DEBUG) {echo 'next'; echo $next; } |
|
35 | 35 | |
36 | 36 | $pfa = ""; |
37 | -foreach ($public_field_attributes as $field){ |
|
37 | +foreach ($public_field_attributes as $field) { |
|
38 | 38 | $pfa .= INDENT . 'public $' . $field . ";\n"; |
39 | 39 | } |
40 | 40 | $pfa = substr($pfa, 0, strlen($pfa)-1); // strip trailing \n |
41 | 41 | |
42 | 42 | $next = str_replace('%public_field_attributes%', $pfa, $next); |
43 | 43 | |
44 | -if( DEBUG ){echo 'next';echo $next;} |
|
44 | +if (DEBUG) {echo 'next'; echo $next; } |
|
45 | 45 | |
46 | 46 | $pa = ""; |
47 | -foreach ($public_field_attributes as $field){ |
|
47 | +foreach ($public_field_attributes as $field) { |
|
48 | 48 | $pa .= '$' . $field . ', '; |
49 | 49 | } |
50 | 50 | $pa = substr($pa, 0, strlen($pa)-2); // strip trailing , and space |
51 | 51 | |
52 | 52 | $next = str_replace('%param_attributes%', $pa, $next); |
53 | 53 | |
54 | -if( DEBUG ){echo 'next';echo $next;} |
|
54 | +if (DEBUG) {echo 'next'; echo $next; } |
|
55 | 55 | |
56 | 56 | $tfa = ""; |
57 | -foreach ($public_field_attributes as $field){ |
|
57 | +foreach ($public_field_attributes as $field) { |
|
58 | 58 | $tfa .= INDENT . INDENT . '$this->' . $field . ' = $' . $field . ";\n"; |
59 | 59 | } |
60 | 60 | $tfa = substr($tfa, 0, strlen($tfa)-1); // strip trailing \n |
61 | 61 | |
62 | 62 | $next = str_replace('%this_field_attributes%', $tfa, $next); |
63 | 63 | |
64 | -/*if( DEBUG ){echo 'next';*/echo $next;//} |
|
64 | +/*if( DEBUG ){echo 'next';*/echo $next; //} |
|
65 | 65 | |
66 | 66 | $destination = 'src' . namespace2dir($next) . '/' . $UseCase . $Entity . 'Command.php'; |
67 | 67 | |
68 | -if( ($count = file_force_contents($destination, $next)) === false ){ |
|
68 | +if (($count = file_force_contents($destination, $next)) === false) { |
|
69 | 69 | echo 'file_put_contents returned false'; |
70 | 70 | } else { |
71 | 71 | echo $destination . ': ' . $count . ' bytes written'; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | $resource_dir = 'resource/'; |
9 | 9 | $resource_file = 'UseCaseXToYCommandHandler.tpl'; |
10 | 10 | |
11 | -if( $argc != 4){ |
|
11 | +if ($argc != 4) { |
|
12 | 12 | echo "Usage:\n"; |
13 | 13 | echo "php tools/makeUseCaseXToYCommandHandler.php UseCase EntityX EntityY\n"; |
14 | 14 | exit(1); |
@@ -27,26 +27,26 @@ discard block |
||
27 | 27 | |
28 | 28 | $template = file_get_contents($resource_dir . $resource_file); |
29 | 29 | |
30 | -if( DEBUG ){echo 'Template';echo $template;} |
|
30 | +if (DEBUG) {echo 'Template'; echo $template; } |
|
31 | 31 | |
32 | 32 | $next = str_replace('%usecase%', $usecase, $template); |
33 | 33 | $next = str_replace('%Usecase%', $UseCase, $next); |
34 | 34 | |
35 | -if( DEBUG ){echo 'next';echo $next;} |
|
35 | +if (DEBUG) {echo 'next'; echo $next; } |
|
36 | 36 | |
37 | 37 | $next = str_replace('%entityX%', $entityX, $next); |
38 | 38 | $next = str_replace('%EntityX%', $EntityX, $next); |
39 | 39 | |
40 | -if( DEBUG ){echo 'next';echo $next;} |
|
40 | +if (DEBUG) {echo 'next'; echo $next; } |
|
41 | 41 | |
42 | 42 | $next = str_replace('%entityY%', $entityY, $next); |
43 | 43 | $next = str_replace('%EntityY%', $EntityY, $next); |
44 | 44 | |
45 | -/*if( DEBUG ){echo 'next';*/echo $next;//} |
|
45 | +/*if( DEBUG ){echo 'next';*/echo $next; //} |
|
46 | 46 | |
47 | 47 | $destination = 'src' . namespace2dir($next) . '/' . $UseCase . $EntityX . 'To' . $EntityY . 'CommandHandler.php'; |
48 | 48 | |
49 | -if( ($count = file_force_contents($destination, $next)) === false ){ |
|
49 | +if (($count = file_force_contents($destination, $next)) === false) { |
|
50 | 50 | echo 'file_put_contents returned false'; |
51 | 51 | } else { |
52 | 52 | echo $destination . ': ' . $count . ' bytes written'; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $resource_dir = 'resource/'; |
8 | 8 | $resource_file = 'UseCaseXsFromYBus.tpl'; |
9 | 9 | |
10 | -if( $argc != 4){ |
|
10 | +if ($argc != 4) { |
|
11 | 11 | echo "Usage:\n"; |
12 | 12 | echo "php tools/makeUseCaseXsFromY.php UseCase EntityX EntityY\n"; |
13 | 13 | exit(1); |
@@ -23,22 +23,22 @@ discard block |
||
23 | 23 | |
24 | 24 | $template = file_get_contents($resource_dir . $resource_file); |
25 | 25 | |
26 | -if( DEBUG ){echo "Template:\n";echo $template;} |
|
26 | +if (DEBUG) {echo "Template:\n"; echo $template; } |
|
27 | 27 | |
28 | 28 | $next = str_replace('%usecase%', $usecase, $template); |
29 | 29 | $next = str_replace('%Usecase%', $UseCase, $next); |
30 | 30 | |
31 | -if( DEBUG ){echo "next: %usecase%/%Usecase% => $usecase/$UseCase\n";echo $next;} |
|
31 | +if (DEBUG) {echo "next: %usecase%/%Usecase% => $usecase/$UseCase\n"; echo $next; } |
|
32 | 32 | |
33 | 33 | $next = str_replace('%entityX%', $entityX, $next); |
34 | 34 | $next = str_replace('%EntityX%', $EntityX, $next); |
35 | 35 | |
36 | -if( DEBUG ){echo "next: %entityX%/%EntityX% => $entityX/$EntityX\n";echo $next;} |
|
36 | +if (DEBUG) {echo "next: %entityX%/%EntityX% => $entityX/$EntityX\n"; echo $next; } |
|
37 | 37 | |
38 | 38 | $next = str_replace('%entityY%', $entityY, $next); |
39 | 39 | $next = str_replace('%EntityY%', $EntityY, $next); |
40 | 40 | |
41 | -if( DEBUG ){echo "next: %entityY%/%EntityY% => $entityY/$EntityY\n";echo $next;} |
|
41 | +if (DEBUG) {echo "next: %entityY%/%EntityY% => $entityY/$EntityY\n"; echo $next; } |
|
42 | 42 | |
43 | 43 | $fcns = getNamespace($next); |
44 | 44 | $next = str_replace('%fcns%', $fcns, $next); |
@@ -46,12 +46,12 @@ discard block |
||
46 | 46 | $fcer = getEntityRepository($next); |
47 | 47 | $next = str_replace('%fcer%', $fcer, $next); |
48 | 48 | |
49 | -if( DEBUG ){echo "result:\n";} |
|
49 | +if (DEBUG) {echo "result:\n"; } |
|
50 | 50 | echo $next; |
51 | 51 | |
52 | 52 | $destination = 'src' . namespace2dir($fcns) . '/' . $UseCase . $EntityX . 'sFrom' . $EntityY . '.php'; |
53 | 53 | |
54 | -if( ($count = file_force_contents($destination, $next)) === false ){ |
|
54 | +if (($count = file_force_contents($destination, $next)) === false) { |
|
55 | 55 | echo 'file_put_contents returned false'; |
56 | 56 | } else { |
57 | 57 | echo $destination . ': ' . $count . ' bytes written'; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $resource_dir = 'resource/'; |
8 | 8 | $resource_file = 'UseCaseXToYBus.tpl'; |
9 | 9 | |
10 | -if( $argc != 4){ |
|
10 | +if ($argc != 4) { |
|
11 | 11 | echo "Usage:\n"; |
12 | 12 | echo "php tools/makeUseCaseXToY.php UseCase EntityX EntityY\n"; |
13 | 13 | exit(1); |
@@ -23,23 +23,23 @@ discard block |
||
23 | 23 | |
24 | 24 | $template = file_get_contents($resource_dir . $resource_file); |
25 | 25 | |
26 | -if( DEBUG ){echo "Template:\n";echo $template;} |
|
26 | +if (DEBUG) {echo "Template:\n"; echo $template; } |
|
27 | 27 | |
28 | 28 | $next = str_replace('%usecase%', $usecase, $template); |
29 | 29 | $next = str_replace('%Usecase%', $UseCase, $next); |
30 | 30 | |
31 | -if( DEBUG ){echo "next: %usecase%/%Usecase% => $usecase/$UseCase\n";echo $next;} |
|
31 | +if (DEBUG) {echo "next: %usecase%/%Usecase% => $usecase/$UseCase\n"; echo $next; } |
|
32 | 32 | |
33 | 33 | |
34 | 34 | $next = str_replace('%entityX%', $entityX, $next); |
35 | 35 | $next = str_replace('%EntityX%', $EntityX, $next); |
36 | 36 | |
37 | -if( DEBUG ){echo "next: %entityX%/%EntityX% => $entityX/$EntityX\n";echo $next;} |
|
37 | +if (DEBUG) {echo "next: %entityX%/%EntityX% => $entityX/$EntityX\n"; echo $next; } |
|
38 | 38 | |
39 | 39 | $next = str_replace('%entityY%', $entityY, $next); |
40 | 40 | $next = str_replace('%EntityY%', $EntityY, $next); |
41 | 41 | |
42 | -if( DEBUG ){echo "next: %entityY%/%EntityY% => $entityY/$EntityY\n";echo $next;} |
|
42 | +if (DEBUG) {echo "next: %entityY%/%EntityY% => $entityY/$EntityY\n"; echo $next; } |
|
43 | 43 | |
44 | 44 | $fcns = getNamespace($next); |
45 | 45 | $next = str_replace('%fcns%', $fcns, $next); |
@@ -48,12 +48,12 @@ discard block |
||
48 | 48 | $next = str_replace('%fcerX%', $fcerX, $next); |
49 | 49 | $next = str_replace('%fcerY%', $fcerY, $next); |
50 | 50 | |
51 | -if( DEBUG ){echo "result:\n";} |
|
51 | +if (DEBUG) {echo "result:\n"; } |
|
52 | 52 | echo $next; |
53 | 53 | |
54 | 54 | $destination = 'src' . namespace2dir($fcns) . '/' . $UseCase . $EntityX . 'To' . $EntityY . '.php'; |
55 | 55 | |
56 | -if( ($count = file_force_contents($destination, $next)) === false ){ |
|
56 | +if (($count = file_force_contents($destination, $next)) === false) { |
|
57 | 57 | echo 'file_put_contents returned false'; |
58 | 58 | } else { |
59 | 59 | echo $destination . ': ' . $count . ' bytes written'; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $resource_dir = 'resource/'; |
8 | 8 | $resource_file = 'UseCaseEntityCommandHandler.tpl'; |
9 | 9 | |
10 | -if( $argc != 4){ |
|
10 | +if ($argc != 4) { |
|
11 | 11 | echo "Usage:\n"; |
12 | 12 | echo "php tools/makeUseCaseEntityCommandHandler.php UseCase Entity fields,...\n"; |
13 | 13 | exit(1); |
@@ -23,32 +23,32 @@ discard block |
||
23 | 23 | |
24 | 24 | $template = file_get_contents($resource_dir . $resource_file); |
25 | 25 | |
26 | -if( DEBUG ){echo 'Template';echo $template;} |
|
26 | +if (DEBUG) {echo 'Template'; echo $template; } |
|
27 | 27 | |
28 | -if( $usecase === 'create' ){ |
|
28 | +if ($usecase === 'create') { |
|
29 | 29 | $next = str_replace('%usecase_params%', 'new %Entity%(%command_field_attributes%)', $template); |
30 | 30 | } else { |
31 | 31 | $next = str_replace('%usecase_params%', '%command_field_attributes%', $template); |
32 | 32 | } |
33 | 33 | |
34 | -if( $usecase === 'read' ){ |
|
34 | +if ($usecase === 'read') { |
|
35 | 35 | $next = str_replace('%return_if_read%', 'return', $next); |
36 | 36 | } else { |
37 | - $next = str_replace('%return_if_read%'.' ', '', $next); |
|
37 | + $next = str_replace('%return_if_read%' . ' ', '', $next); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | $next = str_replace('%usecase%', $usecase, $next); |
41 | 41 | $next = str_replace('%Usecase%', $UseCase, $next); |
42 | 42 | |
43 | -if( DEBUG ){echo 'next';echo $next;} |
|
43 | +if (DEBUG) {echo 'next'; echo $next; } |
|
44 | 44 | |
45 | 45 | $next = str_replace('%entity%', $entity, $next); |
46 | 46 | $next = str_replace('%Entity%', $Entity, $next); |
47 | 47 | |
48 | -if( DEBUG ){echo 'next';echo $next;} |
|
48 | +if (DEBUG) {echo 'next'; echo $next; } |
|
49 | 49 | |
50 | 50 | $cfa = ""; |
51 | -foreach ($public_field_attributes as $field){ |
|
51 | +foreach ($public_field_attributes as $field) { |
|
52 | 52 | $field = strtolower($field); |
53 | 53 | $cfa .= '$command->' . $field . ', '; |
54 | 54 | } |
@@ -56,11 +56,11 @@ discard block |
||
56 | 56 | |
57 | 57 | $next = str_replace('%command_field_attributes%', $cfa, $next); |
58 | 58 | |
59 | -/*if( DEBUG ){echo 'next';*/echo $next;//} |
|
59 | +/*if( DEBUG ){echo 'next';*/echo $next; //} |
|
60 | 60 | |
61 | 61 | $destination = 'src' . namespace2dir($next) . '/' . $UseCase . $Entity . 'CommandHandler.php'; |
62 | 62 | |
63 | -if( ($count = file_force_contents($destination, $next)) === false ){ |
|
63 | +if (($count = file_force_contents($destination, $next)) === false) { |
|
64 | 64 | echo 'file_put_contents returned false'; |
65 | 65 | } else { |
66 | 66 | echo $destination . ': ' . $count . ' bytes written'; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $resource_dir = 'resource/'; |
8 | 8 | $resource_file = 'Entity.tpl'; |
9 | 9 | |
10 | -if( $argc != 3){ |
|
10 | +if ($argc != 3) { |
|
11 | 11 | echo "Usage:\n"; |
12 | 12 | echo "php tools/makeEntity.php Entity fields,...\n"; |
13 | 13 | exit(1); |
@@ -20,16 +20,16 @@ discard block |
||
20 | 20 | |
21 | 21 | $template = file_get_contents($resource_dir . $resource_file); |
22 | 22 | |
23 | -if( DEBUG ){echo 'Template';echo $template;} |
|
23 | +if (DEBUG) {echo 'Template'; echo $template; } |
|
24 | 24 | |
25 | 25 | $next = str_replace('%entity%', $entity, $template); |
26 | 26 | $next = str_replace('%Entity%', $Entity, $next); |
27 | 27 | |
28 | 28 | $pdb = "/**\n"; |
29 | -foreach ($public_field_attributes as $field){ |
|
29 | +foreach ($public_field_attributes as $field) { |
|
30 | 30 | $field = strtolower($field); |
31 | 31 | $Field = ucwords($field); |
32 | - if( $field === 'id' ) { |
|
32 | + if ($field === 'id') { |
|
33 | 33 | $pdb .= ' * @method void set' . $Field . '(int $' . $field . ")\n"; |
34 | 34 | $pdb .= ' * @method int get' . $Field . "()\n"; |
35 | 35 | } else { |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | |
43 | 43 | $next = str_replace('%phpdoc_block%', $pdb, $next); |
44 | 44 | |
45 | -if( DEBUG ){echo 'next';echo $next;} |
|
45 | +if (DEBUG) {echo 'next'; echo $next; } |
|
46 | 46 | |
47 | 47 | $pa = ""; |
48 | 48 | $pfa = ""; |
49 | 49 | $sfa = ""; |
50 | -foreach ($public_field_attributes as $field){ |
|
50 | +foreach ($public_field_attributes as $field) { |
|
51 | 51 | $field = strtolower($field); |
52 | 52 | $Field = ucwords($field); |
53 | 53 | $pa .= '$' . $field . ', '; |
54 | 54 | $pfa .= "'" . $field . "', "; |
55 | - $sfa .= INDENT . INDENT . '$this->set' . $Field . '($' . $field . ");\n"; |
|
55 | + $sfa .= INDENT . INDENT . '$this->set' . $Field . '($' . $field . ");\n"; |
|
56 | 56 | } |
57 | 57 | $pa = substr($pa, 0, strlen($pa)-2); // strip trailing , and space |
58 | 58 | $pfa = substr($pfa, 0, strlen($pfa)-2); // strip trailing , and space |
@@ -62,11 +62,11 @@ discard block |
||
62 | 62 | $next = str_replace('%$public_field_attributes%', $pfa, $next); |
63 | 63 | $next = str_replace('%this_setter_field%', $sfa, $next); |
64 | 64 | |
65 | -/*if( DEBUG ){echo 'next';*/echo $next;//} |
|
65 | +/*if( DEBUG ){echo 'next';*/echo $next; //} |
|
66 | 66 | |
67 | 67 | $destination = 'src' . namespace2dir($next) . '/' . $Entity . '.php'; |
68 | 68 | |
69 | -if( ($count = file_force_contents($destination, $next)) === false ){ |
|
69 | +if (($count = file_force_contents($destination, $next)) === false) { |
|
70 | 70 | echo 'file_put_contents returned false'; |
71 | 71 | } else { |
72 | 72 | echo $destination . ': ' . $count . ' bytes written'; |
@@ -7,7 +7,7 @@ discard block |
||
7 | 7 | $resource_dir = 'resource/'; |
8 | 8 | $resource_file = 'UseCaseXToYCommand.tpl'; |
9 | 9 | |
10 | -if( $argc != 4){ |
|
10 | +if ($argc != 4) { |
|
11 | 11 | echo "Usage:\n"; |
12 | 12 | echo "php tools/makeUseCaseXToYCommand.php UseCase EntityX EntityY\n"; |
13 | 13 | exit(1); |
@@ -23,26 +23,26 @@ discard block |
||
23 | 23 | |
24 | 24 | $template = file_get_contents($resource_dir . $resource_file); |
25 | 25 | |
26 | -if( DEBUG ){echo "Template\n";echo $template;} |
|
26 | +if (DEBUG) {echo "Template\n"; echo $template; } |
|
27 | 27 | |
28 | 28 | $next = str_replace('%usecase%', $usecase, $template); |
29 | 29 | $next = str_replace('%Usecase%', $UseCase, $next); |
30 | 30 | |
31 | -if( DEBUG ){echo "next\n";echo $next;} |
|
31 | +if (DEBUG) {echo "next\n"; echo $next; } |
|
32 | 32 | |
33 | 33 | $next = str_replace('%entityX%', $entityX, $next); |
34 | 34 | $next = str_replace('%EntityX%', $EntityX, $next); |
35 | 35 | |
36 | -if( DEBUG ){echo "next\n";echo $next;} |
|
36 | +if (DEBUG) {echo "next\n"; echo $next; } |
|
37 | 37 | |
38 | 38 | $next = str_replace('%entityY%', $entityY, $next); |
39 | 39 | $next = str_replace('%EntityY%', $EntityY, $next); |
40 | 40 | |
41 | -/*if( DEBUG ){echo "next\n";*/echo $next;//} |
|
41 | +/*if( DEBUG ){echo "next\n";*/echo $next; //} |
|
42 | 42 | |
43 | 43 | $destination = 'src' . namespace2dir($next) . '/' . $UseCase . $EntityX . 'To' . $EntityY . 'Command.php'; |
44 | 44 | |
45 | -if( ($count = file_force_contents($destination, $next)) === false ){ |
|
45 | +if (($count = file_force_contents($destination, $next)) === false) { |
|
46 | 46 | echo 'file_put_contents returned false'; |
47 | 47 | } else { |
48 | 48 | echo $destination . ': ' . $count . ' bytes written'; |