Completed
Push — master ( 28be9d...cc0dae )
by Raphael
02:46
created
src/Scaffolder/Compilers/Blade/EditViewCompiler.php 1 patch
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -11,136 +11,136 @@
 block discarded – undo
11 11
 
12 12
 class EditViewCompiler extends AbstractViewCompiler
13 13
 {
14
-	use InputTypeResolverTrait;
15
-
16
-	/**
17
-	 * Compiles the edit view.
18
-	 *
19
-	 * @param      $stub
20
-	 * @param      $modelName
21
-	 * @param      $modelData
22
-	 * @param      $scaffolderConfig
23
-	 * @param      $hash
24
-	 * @param null $extra
25
-	 *
26
-	 * @return string
27
-	 */
28
-	public function compile($stub, $modelName, $modelData, $scaffolderConfig, $hash, $extra = null)
29
-	{
30
-		if (File::exists(base_path('scaffolder-config/cache/view_edit_' . $hash . self::CACHE_EXT)))
31
-		{
32
-			return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash));
33
-		}
34
-		else
35
-		{
36
-			$this->stub = $stub;
37
-
38
-			return $this->replaceClassName($modelName)
39
-				->replaceBreadcrumb($modelName)
40
-				->addFields($modelData)
41
-				->replacePrimaryKey($modelData)
42
-				->replaceRoutePrefix($scaffolderConfig->generator->routing->prefix)
43
-				->store($modelName, $scaffolderConfig, $this->stub, new FileToCompile(false, $hash));
44
-		}
45
-	}
46
-
47
-	/**
48
-	 * Store the compiled stub.
49
-	 *
50
-	 * @param               $modelName
51
-	 * @param               $scaffolderConfig
52
-	 * @param               $compiled
53
-	 * @param FileToCompile $fileToCompile
54
-	 *
55
-	 * @return string
56
-	 */
57
-	protected function store($modelName, $scaffolderConfig, $compiled, FileToCompile $fileToCompile)
58
-	{
59
-		$folder = PathParser::parse($scaffolderConfig->generator->paths->views) . strtolower($modelName) ;
14
+    use InputTypeResolverTrait;
15
+
16
+    /**
17
+     * Compiles the edit view.
18
+     *
19
+     * @param      $stub
20
+     * @param      $modelName
21
+     * @param      $modelData
22
+     * @param      $scaffolderConfig
23
+     * @param      $hash
24
+     * @param null $extra
25
+     *
26
+     * @return string
27
+     */
28
+    public function compile($stub, $modelName, $modelData, $scaffolderConfig, $hash, $extra = null)
29
+    {
30
+        if (File::exists(base_path('scaffolder-config/cache/view_edit_' . $hash . self::CACHE_EXT)))
31
+        {
32
+            return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash));
33
+        }
34
+        else
35
+        {
36
+            $this->stub = $stub;
37
+
38
+            return $this->replaceClassName($modelName)
39
+                ->replaceBreadcrumb($modelName)
40
+                ->addFields($modelData)
41
+                ->replacePrimaryKey($modelData)
42
+                ->replaceRoutePrefix($scaffolderConfig->generator->routing->prefix)
43
+                ->store($modelName, $scaffolderConfig, $this->stub, new FileToCompile(false, $hash));
44
+        }
45
+    }
46
+
47
+    /**
48
+     * Store the compiled stub.
49
+     *
50
+     * @param               $modelName
51
+     * @param               $scaffolderConfig
52
+     * @param               $compiled
53
+     * @param FileToCompile $fileToCompile
54
+     *
55
+     * @return string
56
+     */
57
+    protected function store($modelName, $scaffolderConfig, $compiled, FileToCompile $fileToCompile)
58
+    {
59
+        $folder = PathParser::parse($scaffolderConfig->generator->paths->views) . strtolower($modelName) ;
60 60
 		
61
-		// create folder directory
62
-		Directory::createIfNotExists($folder, 0755, true);
63
-
64
-		$path   = $folder . '/edit.blade.php';
65
-
66
-		// Store in cache
67
-		if ($fileToCompile->cached)
68
-		{
69
-			File::copy(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $path);
70
-		}
71
-		else
72
-		{
73
-			File::put(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $compiled);
74
-			File::copy(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $path);
75
-		}
76
-
77
-		return $path;
78
-	}
79
-
80
-	/**
81
-	 * Add fields to the edit view.
82
-	 *
83
-	 * @param $modelData
84
-	 *
85
-	 * @return $this
86
-	 */
87
-	private function addFields($modelData)
88
-	{
89
-		$fields = '';
90
-		$firstIteration = true;
91
-
92
-		foreach ($modelData->fields as $field)
93
-		{
94
-			if ($firstIteration)
95
-			{
96
-				$fields .= sprintf(self::getInputFor($field) . PHP_EOL, $field->name);
97
-				$firstIteration = false;
98
-			}
99
-			else
100
-			{
101
-				$fields .= sprintf("\t" . self::getInputFor($field) . PHP_EOL, $field->name);
102
-			}
103
-		}
104
-
105
-		$this->stub = str_replace('{{fields}}', $fields, $this->stub);
106
-
107
-		return $this;
108
-	}
109
-
110
-	/**
111
-	 * Replace the prefix.
112
-	 *
113
-	 * @param $prefix
114
-	 *
115
-	 * @return $this
116
-	 */
117
-	private function replaceRoutePrefix($prefix)
118
-	{
119
-		$this->stub = str_replace('{{route_prefix}}', $prefix, $this->stub);
120
-
121
-		return $this;
122
-	}
123
-
124
-	/**
125
-	 * Replace the primary key.
126
-	 *
127
-	 * @param $modelData
128
-	 */
129
-	private function replacePrimaryKey($modelData)
130
-	{
131
-		$primaryKey = 'id';
132
-
133
-		foreach ($modelData->fields as $field)
134
-		{
135
-			if ($field->index == 'primary')
136
-			{
137
-				$primaryKey = $field->name;
138
-				break;
139
-			}
140
-		}
141
-
142
-		$this->stub = str_replace('{{primaryKey}}', $primaryKey, $this->stub);
143
-
144
-		return $this;
145
-	}
61
+        // create folder directory
62
+        Directory::createIfNotExists($folder, 0755, true);
63
+
64
+        $path   = $folder . '/edit.blade.php';
65
+
66
+        // Store in cache
67
+        if ($fileToCompile->cached)
68
+        {
69
+            File::copy(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $path);
70
+        }
71
+        else
72
+        {
73
+            File::put(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $compiled);
74
+            File::copy(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $path);
75
+        }
76
+
77
+        return $path;
78
+    }
79
+
80
+    /**
81
+     * Add fields to the edit view.
82
+     *
83
+     * @param $modelData
84
+     *
85
+     * @return $this
86
+     */
87
+    private function addFields($modelData)
88
+    {
89
+        $fields = '';
90
+        $firstIteration = true;
91
+
92
+        foreach ($modelData->fields as $field)
93
+        {
94
+            if ($firstIteration)
95
+            {
96
+                $fields .= sprintf(self::getInputFor($field) . PHP_EOL, $field->name);
97
+                $firstIteration = false;
98
+            }
99
+            else
100
+            {
101
+                $fields .= sprintf("\t" . self::getInputFor($field) . PHP_EOL, $field->name);
102
+            }
103
+        }
104
+
105
+        $this->stub = str_replace('{{fields}}', $fields, $this->stub);
106
+
107
+        return $this;
108
+    }
109
+
110
+    /**
111
+     * Replace the prefix.
112
+     *
113
+     * @param $prefix
114
+     *
115
+     * @return $this
116
+     */
117
+    private function replaceRoutePrefix($prefix)
118
+    {
119
+        $this->stub = str_replace('{{route_prefix}}', $prefix, $this->stub);
120
+
121
+        return $this;
122
+    }
123
+
124
+    /**
125
+     * Replace the primary key.
126
+     *
127
+     * @param $modelData
128
+     */
129
+    private function replacePrimaryKey($modelData)
130
+    {
131
+        $primaryKey = 'id';
132
+
133
+        foreach ($modelData->fields as $field)
134
+        {
135
+            if ($field->index == 'primary')
136
+            {
137
+                $primaryKey = $field->name;
138
+                break;
139
+            }
140
+        }
141
+
142
+        $this->stub = str_replace('{{primaryKey}}', $primaryKey, $this->stub);
143
+
144
+        return $this;
145
+    }
146 146
 }
147 147
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/View/CreateViewCompiler.php 1 patch
Indentation   +95 added lines, -95 removed lines patch added patch discarded remove patch
@@ -11,112 +11,112 @@
 block discarded – undo
11 11
 
12 12
 class CreateViewCompiler extends AbstractViewCompiler
13 13
 {
14
-	use InputTypeResolverTrait;
14
+    use InputTypeResolverTrait;
15 15
 
16
-	/**
17
-	 * Compiles the create view.
18
-	 *
19
-	 * @param      $stub
20
-	 * @param      $modelName
21
-	 * @param      $modelData
22
-	 * @param      $scaffolderConfig
23
-	 * @param      $hash
24
-	 * @param null $extra
25
-	 *
26
-	 * @return string
27
-	 */
28
-	public function compile($stub, $modelName, $modelData, $scaffolderConfig, $hash, $extra = null)
29
-	{
30
-		if (File::exists(base_path('scaffolder-config/cache/view_create_' . $hash . self::CACHE_EXT)))
31
-		{
32
-			return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash));
33
-		}
34
-		else
35
-		{
36
-			$this->stub = $stub;
16
+    /**
17
+     * Compiles the create view.
18
+     *
19
+     * @param      $stub
20
+     * @param      $modelName
21
+     * @param      $modelData
22
+     * @param      $scaffolderConfig
23
+     * @param      $hash
24
+     * @param null $extra
25
+     *
26
+     * @return string
27
+     */
28
+    public function compile($stub, $modelName, $modelData, $scaffolderConfig, $hash, $extra = null)
29
+    {
30
+        if (File::exists(base_path('scaffolder-config/cache/view_create_' . $hash . self::CACHE_EXT)))
31
+        {
32
+            return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash));
33
+        }
34
+        else
35
+        {
36
+            $this->stub = $stub;
37 37
 
38
-			return $this->replaceClassName($modelName)
39
-				->replaceBreadcrumb($modelName)
40
-				->addFields($modelData)
41
-				->replaceRoutePrefix($scaffolderConfig->routing->prefix)
42
-				->store($modelName, $scaffolderConfig, $this->stub, new FileToCompile(false, $hash));
43
-		}
44
-	}
38
+            return $this->replaceClassName($modelName)
39
+                ->replaceBreadcrumb($modelName)
40
+                ->addFields($modelData)
41
+                ->replaceRoutePrefix($scaffolderConfig->routing->prefix)
42
+                ->store($modelName, $scaffolderConfig, $this->stub, new FileToCompile(false, $hash));
43
+        }
44
+    }
45 45
 
46
-	/**
47
-	 * Store the compiled stub.
48
-	 *
49
-	 * @param               $modelName
50
-	 * @param               $scaffolderConfig
51
-	 * @param               $compiled
52
-	 * @param FileToCompile $fileToCompile
53
-	 *
54
-	 * @return string
55
-	 */
56
-	protected function store($modelName, $scaffolderConfig, $compiled, FileToCompile $fileToCompile)
57
-	{
58
-		$folder = PathParser::parse($scaffolderConfig->paths->views) . strtolower($modelName) ;
46
+    /**
47
+     * Store the compiled stub.
48
+     *
49
+     * @param               $modelName
50
+     * @param               $scaffolderConfig
51
+     * @param               $compiled
52
+     * @param FileToCompile $fileToCompile
53
+     *
54
+     * @return string
55
+     */
56
+    protected function store($modelName, $scaffolderConfig, $compiled, FileToCompile $fileToCompile)
57
+    {
58
+        $folder = PathParser::parse($scaffolderConfig->paths->views) . strtolower($modelName) ;
59 59
 		
60
-		// create folder directory
61
-		Directory::createIfNotExists($folder, 0755, true);
60
+        // create folder directory
61
+        Directory::createIfNotExists($folder, 0755, true);
62 62
 
63
-		$path = $folder  . '/create.blade.php';
63
+        $path = $folder  . '/create.blade.php';
64 64
 
65
-		// Store in cache
66
-		if ($fileToCompile->cached)
67
-		{
68
-			File::copy(base_path('scaffolder-config/cache/view_create_' . $fileToCompile->hash . self::CACHE_EXT), $path);
69
-		}
70
-		else
71
-		{
72
-			File::put(base_path('scaffolder-config/cache/view_create_' . $fileToCompile->hash . self::CACHE_EXT), $compiled);
73
-			File::copy(base_path('scaffolder-config/cache/view_create_' . $fileToCompile->hash . self::CACHE_EXT), $path);
74
-		}
65
+        // Store in cache
66
+        if ($fileToCompile->cached)
67
+        {
68
+            File::copy(base_path('scaffolder-config/cache/view_create_' . $fileToCompile->hash . self::CACHE_EXT), $path);
69
+        }
70
+        else
71
+        {
72
+            File::put(base_path('scaffolder-config/cache/view_create_' . $fileToCompile->hash . self::CACHE_EXT), $compiled);
73
+            File::copy(base_path('scaffolder-config/cache/view_create_' . $fileToCompile->hash . self::CACHE_EXT), $path);
74
+        }
75 75
 
76
-		return $path;
77
-	}
76
+        return $path;
77
+    }
78 78
 
79
-	/**
80
-	 * Add fields to the create view.
81
-	 *
82
-	 * @param $modelData
83
-	 *
84
-	 * @return $this
85
-	 */
86
-	private function addFields($modelData)
87
-	{
88
-		$fields = '';
89
-		$firstIteration = true;
79
+    /**
80
+     * Add fields to the create view.
81
+     *
82
+     * @param $modelData
83
+     *
84
+     * @return $this
85
+     */
86
+    private function addFields($modelData)
87
+    {
88
+        $fields = '';
89
+        $firstIteration = true;
90 90
 
91
-		foreach ($modelData->fields as $field)
92
-		{
93
-			if ($firstIteration)
94
-			{
95
-				$fields .= sprintf(self::getInputFor($field) . PHP_EOL, $field->name);
96
-				$firstIteration = false;
97
-			}
98
-			else
99
-			{
100
-				$fields .= sprintf("\t" . self::getInputFor($field) . PHP_EOL, $field->name);
101
-			}
102
-		}
91
+        foreach ($modelData->fields as $field)
92
+        {
93
+            if ($firstIteration)
94
+            {
95
+                $fields .= sprintf(self::getInputFor($field) . PHP_EOL, $field->name);
96
+                $firstIteration = false;
97
+            }
98
+            else
99
+            {
100
+                $fields .= sprintf("\t" . self::getInputFor($field) . PHP_EOL, $field->name);
101
+            }
102
+        }
103 103
 
104
-		$this->stub = str_replace('{{fields}}', $fields, $this->stub);
104
+        $this->stub = str_replace('{{fields}}', $fields, $this->stub);
105 105
 
106
-		return $this;
107
-	}
106
+        return $this;
107
+    }
108 108
 
109
-	/**
110
-	 * Replace the prefix.
111
-	 *
112
-	 * @param $prefix
113
-	 *
114
-	 * @return $this
115
-	 */
116
-	private function replaceRoutePrefix($prefix)
117
-	{
118
-		$this->stub = str_replace('{{route_prefix}}', $prefix, $this->stub);
109
+    /**
110
+     * Replace the prefix.
111
+     *
112
+     * @param $prefix
113
+     *
114
+     * @return $this
115
+     */
116
+    private function replaceRoutePrefix($prefix)
117
+    {
118
+        $this->stub = str_replace('{{route_prefix}}', $prefix, $this->stub);
119 119
 
120
-		return $this;
121
-	}
120
+        return $this;
121
+    }
122 122
 }
123 123
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/View/EditViewCompiler.php 1 patch
Indentation   +131 added lines, -131 removed lines patch added patch discarded remove patch
@@ -11,136 +11,136 @@
 block discarded – undo
11 11
 
12 12
 class EditViewCompiler extends AbstractViewCompiler
13 13
 {
14
-	use InputTypeResolverTrait;
15
-
16
-	/**
17
-	 * Compiles the edit view.
18
-	 *
19
-	 * @param      $stub
20
-	 * @param      $modelName
21
-	 * @param      $modelData
22
-	 * @param      $scaffolderConfig
23
-	 * @param      $hash
24
-	 * @param null $extra
25
-	 *
26
-	 * @return string
27
-	 */
28
-	public function compile($stub, $modelName, $modelData, $scaffolderConfig, $hash, $extra = null)
29
-	{
30
-		if (File::exists(base_path('scaffolder-config/cache/view_edit_' . $hash . self::CACHE_EXT)))
31
-		{
32
-			return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash));
33
-		}
34
-		else
35
-		{
36
-			$this->stub = $stub;
37
-
38
-			return $this->replaceClassName($modelName)
39
-				->replaceBreadcrumb($modelName)
40
-				->addFields($modelData)
41
-				->replacePrimaryKey($modelData)
42
-				->replaceRoutePrefix($scaffolderConfig->routing->prefix)
43
-				->store($modelName, $scaffolderConfig, $this->stub, new FileToCompile(false, $hash));
44
-		}
45
-	}
46
-
47
-	/**
48
-	 * Store the compiled stub.
49
-	 *
50
-	 * @param               $modelName
51
-	 * @param               $scaffolderConfig
52
-	 * @param               $compiled
53
-	 * @param FileToCompile $fileToCompile
54
-	 *
55
-	 * @return string
56
-	 */
57
-	protected function store($modelName, $scaffolderConfig, $compiled, FileToCompile $fileToCompile)
58
-	{
59
-		$folder = PathParser::parse($scaffolderConfig->paths->views) . strtolower($modelName) ;
14
+    use InputTypeResolverTrait;
15
+
16
+    /**
17
+     * Compiles the edit view.
18
+     *
19
+     * @param      $stub
20
+     * @param      $modelName
21
+     * @param      $modelData
22
+     * @param      $scaffolderConfig
23
+     * @param      $hash
24
+     * @param null $extra
25
+     *
26
+     * @return string
27
+     */
28
+    public function compile($stub, $modelName, $modelData, $scaffolderConfig, $hash, $extra = null)
29
+    {
30
+        if (File::exists(base_path('scaffolder-config/cache/view_edit_' . $hash . self::CACHE_EXT)))
31
+        {
32
+            return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash));
33
+        }
34
+        else
35
+        {
36
+            $this->stub = $stub;
37
+
38
+            return $this->replaceClassName($modelName)
39
+                ->replaceBreadcrumb($modelName)
40
+                ->addFields($modelData)
41
+                ->replacePrimaryKey($modelData)
42
+                ->replaceRoutePrefix($scaffolderConfig->routing->prefix)
43
+                ->store($modelName, $scaffolderConfig, $this->stub, new FileToCompile(false, $hash));
44
+        }
45
+    }
46
+
47
+    /**
48
+     * Store the compiled stub.
49
+     *
50
+     * @param               $modelName
51
+     * @param               $scaffolderConfig
52
+     * @param               $compiled
53
+     * @param FileToCompile $fileToCompile
54
+     *
55
+     * @return string
56
+     */
57
+    protected function store($modelName, $scaffolderConfig, $compiled, FileToCompile $fileToCompile)
58
+    {
59
+        $folder = PathParser::parse($scaffolderConfig->paths->views) . strtolower($modelName) ;
60 60
 		
61
-		// create folder directory
62
-		Directory::createIfNotExists($folder, 0755, true);
63
-
64
-		$path   = $folder . '/edit.blade.php';
65
-
66
-		// Store in cache
67
-		if ($fileToCompile->cached)
68
-		{
69
-			File::copy(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $path);
70
-		}
71
-		else
72
-		{
73
-			File::put(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $compiled);
74
-			File::copy(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $path);
75
-		}
76
-
77
-		return $path;
78
-	}
79
-
80
-	/**
81
-	 * Add fields to the edit view.
82
-	 *
83
-	 * @param $modelData
84
-	 *
85
-	 * @return $this
86
-	 */
87
-	private function addFields($modelData)
88
-	{
89
-		$fields = '';
90
-		$firstIteration = true;
91
-
92
-		foreach ($modelData->fields as $field)
93
-		{
94
-			if ($firstIteration)
95
-			{
96
-				$fields .= sprintf(self::getInputFor($field) . PHP_EOL, $field->name);
97
-				$firstIteration = false;
98
-			}
99
-			else
100
-			{
101
-				$fields .= sprintf("\t" . self::getInputFor($field) . PHP_EOL, $field->name);
102
-			}
103
-		}
104
-
105
-		$this->stub = str_replace('{{fields}}', $fields, $this->stub);
106
-
107
-		return $this;
108
-	}
109
-
110
-	/**
111
-	 * Replace the prefix.
112
-	 *
113
-	 * @param $prefix
114
-	 *
115
-	 * @return $this
116
-	 */
117
-	private function replaceRoutePrefix($prefix)
118
-	{
119
-		$this->stub = str_replace('{{route_prefix}}', $prefix, $this->stub);
120
-
121
-		return $this;
122
-	}
123
-
124
-	/**
125
-	 * Replace the primary key.
126
-	 *
127
-	 * @param $modelData
128
-	 */
129
-	private function replacePrimaryKey($modelData)
130
-	{
131
-		$primaryKey = 'id';
132
-
133
-		foreach ($modelData->fields as $field)
134
-		{
135
-			if ($field->index == 'primary')
136
-			{
137
-				$primaryKey = $field->name;
138
-				break;
139
-			}
140
-		}
141
-
142
-		$this->stub = str_replace('{{primaryKey}}', $primaryKey, $this->stub);
143
-
144
-		return $this;
145
-	}
61
+        // create folder directory
62
+        Directory::createIfNotExists($folder, 0755, true);
63
+
64
+        $path   = $folder . '/edit.blade.php';
65
+
66
+        // Store in cache
67
+        if ($fileToCompile->cached)
68
+        {
69
+            File::copy(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $path);
70
+        }
71
+        else
72
+        {
73
+            File::put(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $compiled);
74
+            File::copy(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $path);
75
+        }
76
+
77
+        return $path;
78
+    }
79
+
80
+    /**
81
+     * Add fields to the edit view.
82
+     *
83
+     * @param $modelData
84
+     *
85
+     * @return $this
86
+     */
87
+    private function addFields($modelData)
88
+    {
89
+        $fields = '';
90
+        $firstIteration = true;
91
+
92
+        foreach ($modelData->fields as $field)
93
+        {
94
+            if ($firstIteration)
95
+            {
96
+                $fields .= sprintf(self::getInputFor($field) . PHP_EOL, $field->name);
97
+                $firstIteration = false;
98
+            }
99
+            else
100
+            {
101
+                $fields .= sprintf("\t" . self::getInputFor($field) . PHP_EOL, $field->name);
102
+            }
103
+        }
104
+
105
+        $this->stub = str_replace('{{fields}}', $fields, $this->stub);
106
+
107
+        return $this;
108
+    }
109
+
110
+    /**
111
+     * Replace the prefix.
112
+     *
113
+     * @param $prefix
114
+     *
115
+     * @return $this
116
+     */
117
+    private function replaceRoutePrefix($prefix)
118
+    {
119
+        $this->stub = str_replace('{{route_prefix}}', $prefix, $this->stub);
120
+
121
+        return $this;
122
+    }
123
+
124
+    /**
125
+     * Replace the primary key.
126
+     *
127
+     * @param $modelData
128
+     */
129
+    private function replacePrimaryKey($modelData)
130
+    {
131
+        $primaryKey = 'id';
132
+
133
+        foreach ($modelData->fields as $field)
134
+        {
135
+            if ($field->index == 'primary')
136
+            {
137
+                $primaryKey = $field->name;
138
+                break;
139
+            }
140
+        }
141
+
142
+        $this->stub = str_replace('{{primaryKey}}', $primaryKey, $this->stub);
143
+
144
+        return $this;
145
+    }
146 146
 }
147 147
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/ListControllerCompiler.php 1 patch
Indentation   +61 added lines, -61 removed lines patch added patch discarded remove patch
@@ -10,82 +10,82 @@
 block discarded – undo
10 10
 
11 11
 class ListControllerCompiler extends AbstractCompiler
12 12
 {
13
-	protected $cachePrefix 	= 'list_controller_';
14
-	protected $stubFilename = 'ListController.js' ;
15
-
16
-	public function __construct($scaffolderConfig, $modelData = null)
17
-	{
18
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
19
-		parent::__construct($scaffolderConfig, $modelData);
20
-	}
21
-
22
-	/**
23
-	 * Replace and store the Stub.
24
-	 *
25
-	 * @return string
26
-	 */
27
-	public function replaceAndStore()
28
-	{
13
+    protected $cachePrefix 	= 'list_controller_';
14
+    protected $stubFilename = 'ListController.js' ;
15
+
16
+    public function __construct($scaffolderConfig, $modelData = null)
17
+    {
18
+        $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
19
+        parent::__construct($scaffolderConfig, $modelData);
20
+    }
21
+
22
+    /**
23
+     * Replace and store the Stub.
24
+     *
25
+     * @return string
26
+     */
27
+    public function replaceAndStore()
28
+    {
29 29
 		
30
-		return $this->replaceColumns()
31
-					->store(new FileToCompile(false, $this->modelData->modelHash));
30
+        return $this->replaceColumns()
31
+                    ->store(new FileToCompile(false, $this->modelData->modelHash));
32 32
 		
33
-	}
33
+    }
34 34
 
35
-	/**
36
-	 * replace columns
37
-	 *
38
-	 * @return $this
39
-	 */
40
-	public function replaceColumns(){
35
+    /**
36
+     * replace columns
37
+     *
38
+     * @return $this
39
+     */
40
+    public function replaceColumns(){
41 41
 
42
-		$columns = $this->getGridColumns();
42
+        $columns = $this->getGridColumns();
43 43
 
44
-		$this->stub = str_replace('{{grid_columns}}',  join(",\n ", $columns) , $this->stub); 
44
+        $this->stub = str_replace('{{grid_columns}}',  join(",\n ", $columns) , $this->stub); 
45 45
 
46
-		return $this ;
46
+        return $this ;
47 47
 
48
-	}
48
+    }
49 49
 
50
-	public function getGridColumns(){
50
+    public function getGridColumns(){
51 51
 
52
-		$columns = [];
52
+        $columns = [];
53 53
 
54
-		foreach ($this->modelData->fields as $field)
55
-		{
56
-			array_push($columns,  "\t\t\t".sprintf('{ name: vm. $t("%s.columns.%s"), field: "%s%s" }',  $this->modelData->tableName, $field->name, $this->eagerTable, $field->name ) );
54
+        foreach ($this->modelData->fields as $field)
55
+        {
56
+            array_push($columns,  "\t\t\t".sprintf('{ name: vm. $t("%s.columns.%s"), field: "%s%s" }',  $this->modelData->tableName, $field->name, $this->eagerTable, $field->name ) );
57 57
 
58
-			// Check foreign key
59
-			if ($field->foreignKey && isset($field->foreignKey->eager) && $field->foreignKey->eager)
60
-			{
61
-				// search eager fields
62
-				$foreignModelData = $this->getModelData($field->foreignKey->table);
63
-				$foreignControllerCompiler = new ListControllerCompiler($this->scaffolderConfig, $foreignModelData);
64
-				$foreignControllerCompiler->setEagerTable($field->foreignKey->table);
65
-				$eagerColumns 	= $foreignControllerCompiler->getGridColumns();
58
+            // Check foreign key
59
+            if ($field->foreignKey && isset($field->foreignKey->eager) && $field->foreignKey->eager)
60
+            {
61
+                // search eager fields
62
+                $foreignModelData = $this->getModelData($field->foreignKey->table);
63
+                $foreignControllerCompiler = new ListControllerCompiler($this->scaffolderConfig, $foreignModelData);
64
+                $foreignControllerCompiler->setEagerTable($field->foreignKey->table);
65
+                $eagerColumns 	= $foreignControllerCompiler->getGridColumns();
66 66
 
67
-				$columns = array_merge($columns, $eagerColumns);
68
-			}
69
-		}
67
+                $columns = array_merge($columns, $eagerColumns);
68
+            }
69
+        }
70 70
 
71
-		return $columns; 
71
+        return $columns; 
72 72
 
73
-	}
73
+    }
74 74
 	
75 75
 	
76
-	/**
77
-	 * Get output filename
78
-	 *
79
-	 *
80
-	 * @return $this
81
-	 */
82
-	protected function getOutputFilename()
83
-	{
84
-		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ;
85
-
86
-		Directory::createIfNotExists($folder, 0755, true);
87
-
88
-		return $folder .$this->modelData->tableName . '_list.controller.js';
89
-	}
76
+    /**
77
+     * Get output filename
78
+     *
79
+     *
80
+     * @return $this
81
+     */
82
+    protected function getOutputFilename()
83
+    {
84
+        $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ;
85
+
86
+        Directory::createIfNotExists($folder, 0755, true);
87
+
88
+        return $folder .$this->modelData->tableName . '_list.controller.js';
89
+    }
90 90
 
91 91
 }
92 92
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/ListTemplateCompiler.php 1 patch
Indentation   +166 added lines, -166 removed lines patch added patch discarded remove patch
@@ -13,201 +13,201 @@
 block discarded – undo
13 13
 
14 14
 class ListTemplateCompiler extends AbstractCompiler
15 15
 {
16
-	protected $cachePrefix 	= 'list_template_';
17
-	protected $stubFilename = 'ListTemplate.html' ;
18
-
19
-	public function __construct($scaffolderConfig, $modelData = null)
20
-	{
21
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
22
-		parent::__construct($scaffolderConfig, $modelData);
23
-	}
24
-
25
-	/**
26
-	 * Replace and store the Stub.
27
-	 *
28
-	 * @return string
29
-	 */
30
-	public function replaceAndStore()
31
-	{
16
+    protected $cachePrefix 	= 'list_template_';
17
+    protected $stubFilename = 'ListTemplate.html' ;
18
+
19
+    public function __construct($scaffolderConfig, $modelData = null)
20
+    {
21
+        $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
22
+        parent::__construct($scaffolderConfig, $modelData);
23
+    }
24
+
25
+    /**
26
+     * Replace and store the Stub.
27
+     *
28
+     * @return string
29
+     */
30
+    public function replaceAndStore()
31
+    {
32 32
 		
33
-		return $this->replaceInputFields()
34
-					->replaceBelongsToManyFields()
35
-					->store(new FileToCompile(false, $this->modelData->modelHash));
33
+        return $this->replaceInputFields()
34
+                    ->replaceBelongsToManyFields()
35
+                    ->store(new FileToCompile(false, $this->modelData->modelHash));
36 36
 		
37
-	}
37
+    }
38 38
 
39
-	/**
40
-	 * Replace input fields
41
-	 *
42
-	 * @return $this
43
-	 */
44
-	private function replaceInputFields(){
39
+    /**
40
+     * Replace input fields
41
+     *
42
+     * @return $this
43
+     */
44
+    private function replaceInputFields(){
45 45
 
46
-		$inputFields = $this->getInputFields();
46
+        $inputFields = $this->getInputFields();
47 47
 
48
-		$this->stub = str_replace('{{columns_inputs}}', $inputFields, $this->stub);
48
+        $this->stub = str_replace('{{columns_inputs}}', $inputFields, $this->stub);
49 49
 
50
-		return $this;
51
-	}
50
+        return $this;
51
+    }
52 52
 
53
-	/**
54
-	 * get search conditions
55
-	 *
56
-	 * @return $this
57
-	 */
58
-	public function getInputFields(){
53
+    /**
54
+     * get search conditions
55
+     *
56
+     * @return $this
57
+     */
58
+    public function getInputFields(){
59 59
 
60
-		$inputFields = $eagerFields = '';
60
+        $inputFields = $eagerFields = '';
61 61
 
62
-		foreach ($this->modelData->fields as $field)
63
-		{
64
-			$fieldStub = $this->getInputStubByField($field);
62
+        foreach ($this->modelData->fields as $field)
63
+        {
64
+            $fieldStub = $this->getInputStubByField($field);
65 65
 
66
-			if($field->foreignKey){
67
-				$fieldStub 	= $this->replaceForeingStrings($field, $fieldStub) ;
68
-				$fieldStub = str_replace('{{foreign_model_name}}', strtolower(CamelCase::convertToCamelCase($field->foreignKey->table)), $fieldStub);
69
-			}
66
+            if($field->foreignKey){
67
+                $fieldStub 	= $this->replaceForeingStrings($field, $fieldStub) ;
68
+                $fieldStub = str_replace('{{foreign_model_name}}', strtolower(CamelCase::convertToCamelCase($field->foreignKey->table)), $fieldStub);
69
+            }
70 70
 
71
-			$inputFields .= $this->replaceFieldInput($field, $fieldStub) ;
71
+            $inputFields .= $this->replaceFieldInput($field, $fieldStub) ;
72 72
 
73
-			// Check foreign key
74
-			if ($field->foreignKey && isset($field->foreignKey->eager) && $field->foreignKey->eager)
75
-			{
76
-				// search eager fields
77
-				$foreignModelData = $this->getModelData($field->foreignKey->table);
78
-				$foreignControllerCompiler = new ListTemplateCompiler($this->scaffolderConfig, $foreignModelData);
79
-				$foreignControllerCompiler->setEagerTable($this->modelData->tableName);
80
-				$eagerFields 	.= $foreignControllerCompiler->getInputFields();
81
-			}
73
+            // Check foreign key
74
+            if ($field->foreignKey && isset($field->foreignKey->eager) && $field->foreignKey->eager)
75
+            {
76
+                // search eager fields
77
+                $foreignModelData = $this->getModelData($field->foreignKey->table);
78
+                $foreignControllerCompiler = new ListTemplateCompiler($this->scaffolderConfig, $foreignModelData);
79
+                $foreignControllerCompiler->setEagerTable($this->modelData->tableName);
80
+                $eagerFields 	.= $foreignControllerCompiler->getInputFields();
81
+            }
82 82
 
83
-		}
83
+        }
84 84
 
85
-		// replace table name
86
-		$inputFields = str_replace('{{table_name}}', $this->modelData->tableName, $inputFields);
85
+        // replace table name
86
+        $inputFields = str_replace('{{table_name}}', $this->modelData->tableName, $inputFields);
87 87
 		
88
-		$this->stub = str_replace('{{eager_objects_inputs}}', $eagerFields, $this->stub); 
89
-
90
-		return $inputFields ;
91
-
92
-	}
93
-
94
-	/**
95
-	 * replace field stub with fields and validations
96
-	 *
97
-	 * @param string $field
98
-	 * @param string $fieldStub
99
-	 *
100
-	 * @return $this
101
-	 */
102
-	protected function replaceFieldInput($field, $fieldStub){
103
-		$fieldStub = $this->replaceFieldStrings($field, $fieldStub) ;
104
-		$fieldStub = $this->replaceFieldValidations($field, $fieldStub) ;
105
-
106
-		return $fieldStub ;
107
-	}
108
-
109
-	/**
110
-	 * replace field stub with fields and validations
111
-	 *
112
-	 * @param string $field
113
-	 * @param string $fieldStub
114
-	 *
115
-	 * @return $this
116
-	 */
117
-	protected function replaceFieldValidations($field, $fieldStub){
118
-		$fieldStub = $this->replaceFieldStrings($field, $fieldStub) ;
88
+        $this->stub = str_replace('{{eager_objects_inputs}}', $eagerFields, $this->stub); 
89
+
90
+        return $inputFields ;
91
+
92
+    }
93
+
94
+    /**
95
+     * replace field stub with fields and validations
96
+     *
97
+     * @param string $field
98
+     * @param string $fieldStub
99
+     *
100
+     * @return $this
101
+     */
102
+    protected function replaceFieldInput($field, $fieldStub){
103
+        $fieldStub = $this->replaceFieldStrings($field, $fieldStub) ;
104
+        $fieldStub = $this->replaceFieldValidations($field, $fieldStub) ;
105
+
106
+        return $fieldStub ;
107
+    }
108
+
109
+    /**
110
+     * replace field stub with fields and validations
111
+     *
112
+     * @param string $field
113
+     * @param string $fieldStub
114
+     *
115
+     * @return $this
116
+     */
117
+    protected function replaceFieldValidations($field, $fieldStub){
118
+        $fieldStub = $this->replaceFieldStrings($field, $fieldStub) ;
119 119
 		
120
-		$validationsConverted = Validator::convertValidations($field->validations, true);
120
+        $validationsConverted = Validator::convertValidations($field->validations, true);
121 121
 
122
-		$inputValidations = '' ; 
122
+        $inputValidations = '' ; 
123 123
 
124
-		foreach ($validationsConverted as $attribute => $value) {
125
-			if($value)
126
-				$inputValidations .=  ' '.$attribute.'="'. $value.'"' ;
127
-			else
128
-				$inputValidations .=  ' '.$attribute  ; 
129
-		}
124
+        foreach ($validationsConverted as $attribute => $value) {
125
+            if($value)
126
+                $inputValidations .=  ' '.$attribute.'="'. $value.'"' ;
127
+            else
128
+                $inputValidations .=  ' '.$attribute  ; 
129
+        }
130 130
 
131
-		$fieldStub = str_replace('{{field_validation}}', $inputValidations, $fieldStub);
131
+        $fieldStub = str_replace('{{field_validation}}', $inputValidations, $fieldStub);
132 132
 
133
-		return $fieldStub ;
134
-	}
133
+        return $fieldStub ;
134
+    }
135 135
 
136
-	/**
137
-	 * Replace belongs to many fields
138
-	 *
139
-	 * @return $this
140
-	 */
141
-	protected function replaceBelongsToManyFields() {
136
+    /**
137
+     * Replace belongs to many fields
138
+     *
139
+     * @return $this
140
+     */
141
+    protected function replaceBelongsToManyFields() {
142 142
 		
143
-		$belongToManyFields = '';
143
+        $belongToManyFields = '';
144 144
 		
145
-		foreach ($this->modelData->reverseRelationships as $relationship)
146
-		{
147
-			if ($relationship->type == "belongsToMany") {
148
-				$fieldStub = File::get($this->stubsDirectory . 'List/'. CamelCase::convertToCamelCase($relationship->ui). '.html');
149
-
150
-				$fieldStub = str_replace('{{related_table}}',CamelCase::convertToCamelCase($relationship->relatedTable), $fieldStub);
151
-				$fieldStub = str_replace('{{related_table_lw}}', strtolower(CamelCase::convertToCamelCase($relationship->relatedTable)), $fieldStub);
152
-				$fieldStub = str_replace('{{table_name}}', $this->modelData->tableName, $fieldStub);
153
-				$fieldStub = str_replace('{{related_table_lw_pl}}', CamelCase::pluralize(strtolower($relationship->relatedTable)), $fieldStub);
145
+        foreach ($this->modelData->reverseRelationships as $relationship)
146
+        {
147
+            if ($relationship->type == "belongsToMany") {
148
+                $fieldStub = File::get($this->stubsDirectory . 'List/'. CamelCase::convertToCamelCase($relationship->ui). '.html');
149
+
150
+                $fieldStub = str_replace('{{related_table}}',CamelCase::convertToCamelCase($relationship->relatedTable), $fieldStub);
151
+                $fieldStub = str_replace('{{related_table_lw}}', strtolower(CamelCase::convertToCamelCase($relationship->relatedTable)), $fieldStub);
152
+                $fieldStub = str_replace('{{table_name}}', $this->modelData->tableName, $fieldStub);
153
+                $fieldStub = str_replace('{{related_table_lw_pl}}', CamelCase::pluralize(strtolower($relationship->relatedTable)), $fieldStub);
154 154
 				
155
-				$belongToManyFields .= $fieldStub;	
156
-			}
157
-		}
155
+                $belongToManyFields .= $fieldStub;	
156
+            }
157
+        }
158 158
 
159
-		$this->stub = str_replace('{{belongs_to_many_inputs}}', $belongToManyFields, $this->stub); 
159
+        $this->stub = str_replace('{{belongs_to_many_inputs}}', $belongToManyFields, $this->stub); 
160 160
 
161
-		return $this;
162
-	}
161
+        return $this;
162
+    }
163 163
 
164 164
 	
165
-	/**
166
-	 * get input field stub by ui type
167
-	 *
168
-	 * @param string $field
169
-	 *
170
-	 * @return $this
171
-	 */
172
-	private $inputStub = [];
173
-	private function getInputStubByField($field){
165
+    /**
166
+     * get input field stub by ui type
167
+     *
168
+     * @param string $field
169
+     *
170
+     * @return $this
171
+     */
172
+    private $inputStub = [];
173
+    private function getInputStubByField($field){
174 174
 		
175
-		if($field->index == 'primary'){
176
-			$uiType = 'primary' ;
177
-		}
178
-		elseif(isset($field->foreignKey) && $field->foreignKey){
179
-			if(isset($field->foreignKey->eager) && $field->foreignKey->eager)
180
-				$uiType = 'foreign_eager' ;
181
-			else 
182
-				$uiType = $field->type->ui ;
183
-		}
184
-		else {
185
-			$uiType = $field->type->ui ;
186
-		}
187
-
188
-		if(array_key_exists($uiType, $this->inputStub)){
189
-			return $this->inputStub[$uiType];
190
-		}
191
-		else {
192
-			$this->inputStub[$uiType] = File::get($this->stubsDirectory . 'List/'. CamelCase::convertToCamelCase($uiType). '.html');
193
-
194
-			return $this->inputStub[$uiType];
195
-		}
196
-	}
175
+        if($field->index == 'primary'){
176
+            $uiType = 'primary' ;
177
+        }
178
+        elseif(isset($field->foreignKey) && $field->foreignKey){
179
+            if(isset($field->foreignKey->eager) && $field->foreignKey->eager)
180
+                $uiType = 'foreign_eager' ;
181
+            else 
182
+                $uiType = $field->type->ui ;
183
+        }
184
+        else {
185
+            $uiType = $field->type->ui ;
186
+        }
187
+
188
+        if(array_key_exists($uiType, $this->inputStub)){
189
+            return $this->inputStub[$uiType];
190
+        }
191
+        else {
192
+            $this->inputStub[$uiType] = File::get($this->stubsDirectory . 'List/'. CamelCase::convertToCamelCase($uiType). '.html');
193
+
194
+            return $this->inputStub[$uiType];
195
+        }
196
+    }
197 197
 	
198
-	/**
199
-	 * Get output filename
200
-	 *
201
-	 *
202
-	 * @return $this
203
-	 */
204
-	protected function getOutputFilename()
205
-	{
206
-		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ;
207
-
208
-		Directory::createIfNotExists($folder, 0755, true);
209
-
210
-		return $folder .$this->modelData->tableName . '_list.html';
211
-	}
198
+    /**
199
+     * Get output filename
200
+     *
201
+     *
202
+     * @return $this
203
+     */
204
+    protected function getOutputFilename()
205
+    {
206
+        $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ;
207
+
208
+        Directory::createIfNotExists($folder, 0755, true);
209
+
210
+        return $folder .$this->modelData->tableName . '_list.html';
211
+    }
212 212
 
213 213
 }
214 214
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/ListDetailCompiler.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -10,40 +10,40 @@
 block discarded – undo
10 10
 
11 11
 class ListDetailCompiler extends AbstractCompiler
12 12
 {
13
-	protected $cachePrefix 	= 'list_detail_';
14
-	protected $stubFilename = 'DetailDialog.html' ;
15
-
16
-	public function __construct($scaffolderConfig, $modelData = null)
17
-	{
18
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
19
-		parent::__construct($scaffolderConfig, $modelData);
20
-	}
21
-
22
-	/**
23
-	 * Replace and store the Stub.
24
-	 *
25
-	 * @return string
26
-	 */
27
-	public function replaceAndStore()
28
-	{
13
+    protected $cachePrefix 	= 'list_detail_';
14
+    protected $stubFilename = 'DetailDialog.html' ;
15
+
16
+    public function __construct($scaffolderConfig, $modelData = null)
17
+    {
18
+        $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
19
+        parent::__construct($scaffolderConfig, $modelData);
20
+    }
21
+
22
+    /**
23
+     * Replace and store the Stub.
24
+     *
25
+     * @return string
26
+     */
27
+    public function replaceAndStore()
28
+    {
29 29
 		
30
-		return $this->store(new FileToCompile(false, $this->modelData->modelHash));
30
+        return $this->store(new FileToCompile(false, $this->modelData->modelHash));
31 31
 		
32
-	}
32
+    }
33 33
 	
34
-	/**
35
-	 * Get output filename
36
-	 *
37
-	 *
38
-	 * @return $this
39
-	 */
40
-	protected function getOutputFilename()
41
-	{
42
-		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ;
43
-
44
-		Directory::createIfNotExists($folder, 0755, true);
45
-
46
-		return $folder .$this->modelData->tableName . '_details.dialog.html';
47
-	}
34
+    /**
35
+     * Get output filename
36
+     *
37
+     *
38
+     * @return $this
39
+     */
40
+    protected function getOutputFilename()
41
+    {
42
+        $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/list/' ;
43
+
44
+        Directory::createIfNotExists($folder, 0755, true);
45
+
46
+        return $folder .$this->modelData->tableName . '_details.dialog.html';
47
+    }
48 48
 
49 49
 }
50 50
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/IndexApiCompiler.php 1 patch
Indentation   +45 added lines, -45 removed lines patch added patch discarded remove patch
@@ -10,56 +10,56 @@
 block discarded – undo
10 10
 
11 11
 class IndexApiCompiler extends AbstractCompiler
12 12
 {
13
-	protected $cachePrefix 	= 'index_api_';
14
-	protected $stubFilename = 'IndexApi.js' ;
13
+    protected $cachePrefix 	= 'index_api_';
14
+    protected $stubFilename = 'IndexApi.js' ;
15 15
 
16
-	public function __construct($scaffolderConfig, $modelData = null)
17
-	{
18
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
19
-		parent::__construct($scaffolderConfig, $modelData);
20
-	}
16
+    public function __construct($scaffolderConfig, $modelData = null)
17
+    {
18
+        $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
19
+        parent::__construct($scaffolderConfig, $modelData);
20
+    }
21 21
 
22
-	/**
23
-	 * Replace and store the Stub.
24
-	 *
25
-	 * @return string
26
-	 */
27
-	public function replaceAndStore()
28
-	{
29
-		return $this->store(new FileToCompile(false, $this->cachePrefix));
30
-	}
22
+    /**
23
+     * Replace and store the Stub.
24
+     *
25
+     * @return string
26
+     */
27
+    public function replaceAndStore()
28
+    {
29
+        return $this->store(new FileToCompile(false, $this->cachePrefix));
30
+    }
31 31
 
32
-	/**
33
-	 * Compiles .
34
-	 *
35
-	 * @param null $extra
36
-	 *
37
-	 * @return string
38
-	 */
39
-	public function compile($extra = null)
40
-	{
41
-		if (File::exists(base_path('scaffolder-config/cache/' . $this->cachePrefix  . self::CACHE_EXT)))
42
-		{
43
-			return $this->store(new FileToCompile(true, $this->cachePrefix));
44
-		}
45
-		else
46
-		{
32
+    /**
33
+     * Compiles .
34
+     *
35
+     * @param null $extra
36
+     *
37
+     * @return string
38
+     */
39
+    public function compile($extra = null)
40
+    {
41
+        if (File::exists(base_path('scaffolder-config/cache/' . $this->cachePrefix  . self::CACHE_EXT)))
42
+        {
43
+            return $this->store(new FileToCompile(true, $this->cachePrefix));
44
+        }
45
+        else
46
+        {
47 47
 
48
-			return $this->replaceAndStore();
49
-		}
50
-	}
48
+            return $this->replaceAndStore();
49
+        }
50
+    }
51 51
 	
52
-	/**
53
-	 * Get output filename
54
-	 *
55
-	 *
56
-	 * @return $this
57
-	 */
58
-	protected function getOutputFilename()
59
-	{
60
-		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->index);
52
+    /**
53
+     * Get output filename
54
+     *
55
+     *
56
+     * @return $this
57
+     */
58
+    protected function getOutputFilename()
59
+    {
60
+        $folder = PathParser::parse($this->scaffolderConfig->generator->paths->index);
61 61
 
62
-		return $folder  . 'index.api.js';
63
-	}
62
+        return $folder  . 'index.api.js';
63
+    }
64 64
 
65 65
 }
66 66
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/TranslateCompiler.php 1 patch
Indentation   +65 added lines, -65 removed lines patch added patch discarded remove patch
@@ -13,73 +13,73 @@
 block discarded – undo
13 13
 
14 14
 class TranslateCompiler extends AbstractCompiler
15 15
 {
16
-	protected $cachePrefix 	= 'translate_';
17
-	protected $stubFilename = 'Translate.js' ;
18
-
19
-	public function __construct($scaffolderConfig, $modelData = null)
20
-	{
21
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
22
-		parent::__construct($scaffolderConfig, $modelData);
23
-	}
24
-
25
-	/**
26
-	 * Replace and store the Stub.
27
-	 *
28
-	 * @return string
29
-	 */
30
-	public function replaceAndStore()
31
-	{
16
+    protected $cachePrefix 	= 'translate_';
17
+    protected $stubFilename = 'Translate.js' ;
18
+
19
+    public function __construct($scaffolderConfig, $modelData = null)
20
+    {
21
+        $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
22
+        parent::__construct($scaffolderConfig, $modelData);
23
+    }
24
+
25
+    /**
26
+     * Replace and store the Stub.
27
+     *
28
+     * @return string
29
+     */
30
+    public function replaceAndStore()
31
+    {
32 32
 		
33
-		return $this->replaceColumns()
34
-					->replaceArea()
35
-					->store(new FileToCompile(false, $this->modelData->modelHash));
33
+        return $this->replaceColumns()
34
+                    ->replaceArea()
35
+                    ->store(new FileToCompile(false, $this->modelData->modelHash));
36 36
 		
37
-	}
38
-
39
-	/**
40
-	 * replace columns
41
-	 *
42
-	 * @return $this
43
-	 */
44
-	public function replaceArea(){
45
-		$this->stub = str_replace('{{singular}}', ucwords($this->modelData->tableName), $this->stub); 
46
-		$this->stub = str_replace('{{plural}}', ucwords(CamelCase::pluralize($this->modelData->tableName)), $this->stub); 
47
-		return $this;
48
-	}
49
-
50
-	/**
51
-	 * replace columns
52
-	 *
53
-	 * @return $this
54
-	 */
55
-	public function replaceColumns(){
56
-
57
-		$columns = [];
58
-
59
-		foreach ($this->modelData->fields as $field)
60
-		{
61
-			array_push($columns,  "\t\t".sprintf('"%s" : "%s"',  $field->name,  CamelCase::convertToCamelCase($field->name) ));
62
-		}
63
-
64
-		$this->stub = str_replace('{{columns}}', join(",\n", $columns), $this->stub); 
65
-
66
-		return $this ;
67
-
68
-	}
37
+    }
38
+
39
+    /**
40
+     * replace columns
41
+     *
42
+     * @return $this
43
+     */
44
+    public function replaceArea(){
45
+        $this->stub = str_replace('{{singular}}', ucwords($this->modelData->tableName), $this->stub); 
46
+        $this->stub = str_replace('{{plural}}', ucwords(CamelCase::pluralize($this->modelData->tableName)), $this->stub); 
47
+        return $this;
48
+    }
49
+
50
+    /**
51
+     * replace columns
52
+     *
53
+     * @return $this
54
+     */
55
+    public function replaceColumns(){
56
+
57
+        $columns = [];
58
+
59
+        foreach ($this->modelData->fields as $field)
60
+        {
61
+            array_push($columns,  "\t\t".sprintf('"%s" : "%s"',  $field->name,  CamelCase::convertToCamelCase($field->name) ));
62
+        }
63
+
64
+        $this->stub = str_replace('{{columns}}', join(",\n", $columns), $this->stub); 
65
+
66
+        return $this ;
67
+
68
+    }
69 69
 	
70
-	/**
71
-	 * Get output filename
72
-	 *
73
-	 *
74
-	 * @return $this
75
-	 */
76
-	protected function getOutputFilename()
77
-	{
78
-		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/i18n/' ;
79
-
80
-		Directory::createIfNotExists($folder, 0755, true);
81
-
82
-		return $folder . 'en.json';
83
-	}
70
+    /**
71
+     * Get output filename
72
+     *
73
+     *
74
+     * @return $this
75
+     */
76
+    protected function getOutputFilename()
77
+    {
78
+        $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/i18n/' ;
79
+
80
+        Directory::createIfNotExists($folder, 0755, true);
81
+
82
+        return $folder . 'en.json';
83
+    }
84 84
 
85 85
 }
86 86
\ No newline at end of file
Please login to merge, or discard this patch.
src/Scaffolder/Compilers/AngularJs/ResourceCompiler.php 1 patch
Indentation   +32 added lines, -32 removed lines patch added patch discarded remove patch
@@ -10,38 +10,38 @@
 block discarded – undo
10 10
 
11 11
 class ResourceCompiler extends AbstractCompiler
12 12
 {
13
-	protected $cachePrefix 	= 'resource_';
14
-	protected $stubFilename = 'Resource.js' ;
15
-
16
-	public function __construct($scaffolderConfig, $modelData = null)
17
-	{
18
-		$this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
19
-		parent::__construct($scaffolderConfig, $modelData);
20
-	}
21
-
22
-	/**
23
-	 * Replace and store the Stub.
24
-	 *
25
-	 * @return string
26
-	 */
27
-	public function replaceAndStore()
28
-	{
29
-		return $this->store(new FileToCompile(false, $this->modelData->modelHash));
30
-	}
13
+    protected $cachePrefix 	= 'resource_';
14
+    protected $stubFilename = 'Resource.js' ;
15
+
16
+    public function __construct($scaffolderConfig, $modelData = null)
17
+    {
18
+        $this->stubsDirectory = __DIR__ . '/../../../../stubs/AngularJs/';
19
+        parent::__construct($scaffolderConfig, $modelData);
20
+    }
21
+
22
+    /**
23
+     * Replace and store the Stub.
24
+     *
25
+     * @return string
26
+     */
27
+    public function replaceAndStore()
28
+    {
29
+        return $this->store(new FileToCompile(false, $this->modelData->modelHash));
30
+    }
31 31
 	
32
-	/**
33
-	 * Get output filename
34
-	 *
35
-	 *
36
-	 * @return $this
37
-	 */
38
-	protected function getOutputFilename()
39
-	{
40
-		$folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/' ;
41
-
42
-		Directory::createIfNotExists($folder, 0755, true);
43
-
44
-		return $folder .  $this->modelData->tableName . '.resource.js';
45
-	}
32
+    /**
33
+     * Get output filename
34
+     *
35
+     *
36
+     * @return $this
37
+     */
38
+    protected function getOutputFilename()
39
+    {
40
+        $folder = PathParser::parse($this->scaffolderConfig->generator->paths->pages).$this->modelData->tableName.'/' ;
41
+
42
+        Directory::createIfNotExists($folder, 0755, true);
43
+
44
+        return $folder .  $this->modelData->tableName . '.resource.js';
45
+    }
46 46
 
47 47
 }
48 48
\ No newline at end of file
Please login to merge, or discard this patch.