1 | <?php |
||
9 | class Composer extends AbstractFile |
||
10 | { |
||
11 | const JSON_FILE_EXTENSION = 'json'; |
||
12 | /** |
||
13 | * Tests purpose: do not run composer update command |
||
14 | * @var bool |
||
15 | */ |
||
16 | protected $runComposerUpdate = true; |
||
17 | /** |
||
18 | * @see \WsdlToPhp\PackageGenerator\File\AbstractFile::writeFile() |
||
19 | * @return int|bool |
||
20 | */ |
||
21 | 45 | protected function writeFile() |
|
50 | /** |
||
51 | * @return Composer |
||
52 | */ |
||
53 | 45 | protected function completeComposerJson() |
|
61 | /** |
||
62 | * @return Composer |
||
63 | */ |
||
64 | 45 | protected function addAutoloadToComposerJson(array &$content) |
|
71 | /** |
||
72 | * @return Composer |
||
73 | */ |
||
74 | 45 | protected function addComposerSettings(array &$content) |
|
79 | /** |
||
80 | * @return array |
||
81 | */ |
||
82 | 45 | protected function getPsr4Autoload() |
|
83 | { |
||
84 | 45 | $namespace = new EmptyModel($this->getGenerator(), ''); |
|
85 | 45 | if ($namespace->getNamespace() !== '') { |
|
86 | 20 | $namespaceKey = sprintf('%s\\', $namespace->getNamespace()); |
|
87 | 8 | } else { |
|
88 | 25 | $namespaceKey = ''; |
|
89 | 2 | } |
|
90 | 45 | $src = rtrim($this->generator->getOptionSrcDirname(), DIRECTORY_SEPARATOR); |
|
91 | 2 | return [ |
|
92 | 45 | $namespaceKey => sprintf('./%s', empty($src) ? '' : $src . DIRECTORY_SEPARATOR), |
|
93 | 18 | ]; |
|
94 | } |
||
95 | /** |
||
96 | * @return array |
||
97 | */ |
||
98 | 45 | protected function getComposerFileContent() |
|
107 | /** |
||
108 | * @param array $content |
||
109 | * @return Composer |
||
110 | */ |
||
111 | 45 | protected function setComposerFileContent(array $content) |
|
119 | /** |
||
120 | * @param array $content |
||
121 | * @return string |
||
122 | */ |
||
123 | 45 | protected static function encodeToJson($content) |
|
132 | /** |
||
133 | * @return string |
||
134 | */ |
||
135 | 45 | protected function getComposerFilePath() |
|
139 | /** |
||
140 | * @param bool $runComposerUpdate |
||
141 | * @return Composer |
||
142 | */ |
||
143 | 25 | public function setRunComposerUpdate($runComposerUpdate) |
|
148 | /** |
||
149 | * @return bool |
||
150 | */ |
||
151 | 50 | public function getRunComposerUpdate() |
|
155 | /** |
||
156 | * @return string |
||
157 | */ |
||
158 | 25 | public function getFileExtension() |
|
162 | } |
||
163 |