Skip to content

Commit fe41cc7

Browse files
committed
Class ordering from PHPCSFixer
1 parent 2edb181 commit fe41cc7

File tree

10 files changed

+207
-207
lines changed

10 files changed

+207
-207
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"psr-4": {"PHPFUI\\InstaDoc\\": "src/PHPFUI/InstaDoc/"}
2626
},
2727
"require-dev": {
28-
"phpunit/phpunit": "<10.0",
28+
"phpunit/phpunit": "<11.0",
2929
"phpfui/html-unit-tester": "^1.0",
3030
"roave/security-advisories": "dev-latest",
3131
"phpfui/phpunit-syntax-coverage": "^1.0",

src/PHPFUI/InstaDoc/Controller.php

+28-28
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,34 @@ public function getClassUrl(string $namespacedClass) : string
313313
return $url;
314314
}
315315

316+
/**
317+
* Get parameters for the class and method
318+
*/
319+
public function getConstructorParameters(string $className) : string
320+
{
321+
try
322+
{
323+
$reflection = new \ReflectionClass($className);
324+
}
325+
catch (\Exception)
326+
{
327+
return '';
328+
}
329+
330+
$methodName = '__construct';
331+
332+
if (! $reflection->hasMethod($methodName))
333+
{
334+
return '';
335+
}
336+
337+
$method = $reflection->getMethod($methodName);
338+
$section = new \PHPFUI\InstaDoc\Section\CodeCommon($this, $className);
339+
$parameters = $section->getMethodParameters($method);
340+
341+
return \Soundasleep\Html2Text::convert($parameters, ['drop_links' => true, 'ignore_errors' => true]);
342+
}
343+
316344
/**
317345
* Returns the current page for the controller that will be used to display the documentation.
318346
*/
@@ -461,34 +489,6 @@ public function getParameters() : array
461489
return $this->parameters;
462490
}
463491

464-
/**
465-
* Get parameters for the class and method
466-
*/
467-
public function getConstructorParameters(string $className) : string
468-
{
469-
try
470-
{
471-
$reflection = new \ReflectionClass($className);
472-
}
473-
catch (\Exception)
474-
{
475-
return '';
476-
}
477-
478-
$methodName = '__construct';
479-
480-
if (! $reflection->hasMethod($methodName))
481-
{
482-
return '';
483-
}
484-
485-
$method = $reflection->getMethod($methodName);
486-
$section = new \PHPFUI\InstaDoc\Section\CodeCommon($this, $className);
487-
$parameters = $section->getMethodParameters($method);
488-
489-
return \Soundasleep\Html2Text::convert($parameters, ['drop_links' => true, 'ignore_errors' => true]);
490-
}
491-
492492
/**
493493
* Get a section for display. Override to change layout
494494
*/

src/PHPFUI/InstaDoc/FileManager.php

+32-32
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ class FileManager
88

99
private string $configFile = '..';
1010

11-
private string $extension = '.serial';
12-
13-
private string $fileName = '';
14-
1511
/**
1612
* @var array<string>
1713
*/
1814
private array $excludedNamespaces = [];
1915

16+
private string $extension = '.serial';
17+
18+
private string $fileName = '';
19+
2020
/**
2121
* @var array<array<string>>
2222
*/
@@ -36,21 +36,6 @@ public function __construct(string $composerJsonPath = '')
3636
$this->fileName = \substr($class, \strrpos($class, '\\') + 1);
3737
}
3838

39-
/**
40-
* You can add a Namespace directly. Specify the namespace (no
41-
* leading backslash) and the directory containing the class
42-
* files. This is realitive to the current script directory.
43-
* You can also pass an option localGit flag indicating this
44-
* directory is in the project git repo. This will allow you to
45-
* see the git history on the file.
46-
*/
47-
public function addNamespace(string $namespace, string $directory, bool $localGit = false) : FileManager
48-
{
49-
$this->includedNamespaces[] = [$namespace, $directory, $localGit];
50-
51-
return $this;
52-
}
53-
5439
/**
5540
* The classes in the global namespace are handled slightly
5641
* differently, as this should be the exception rather than the
@@ -67,21 +52,16 @@ public function addGlobalNameSpaceClass(string $filename, bool $localGit = false
6752
}
6853

6954
/**
70-
* Set file extension for saving index file
71-
*/
72-
public function setExtension(string $extension = '.serial') : self
73-
{
74-
$this->extension = $extension;
75-
76-
return $this;
77-
}
78-
79-
/**
80-
* Set base file name for saving index file
55+
* You can add a Namespace directly. Specify the namespace (no
56+
* leading backslash) and the directory containing the class
57+
* files. This is realitive to the current script directory.
58+
* You can also pass an option localGit flag indicating this
59+
* directory is in the project git repo. This will allow you to
60+
* see the git history on the file.
8161
*/
82-
public function setBaseFile(string $fileName) : self
62+
public function addNamespace(string $namespace, string $directory, bool $localGit = false) : FileManager
8363
{
84-
$this->fileName = $fileName;
64+
$this->includedNamespaces[] = [$namespace, $directory, $localGit];
8565

8666
return $this;
8767
}
@@ -177,6 +157,16 @@ public function save(string $fileName = '') : bool
177157
return \PHPFUI\InstaDoc\NamespaceTree::save($this->getSerializedName($fileName));
178158
}
179159

160+
/**
161+
* Set base file name for saving index file
162+
*/
163+
public function setBaseFile(string $fileName) : self
164+
{
165+
$this->fileName = $fileName;
166+
167+
return $this;
168+
}
169+
180170
public function setComposerPath(string $composerJsonPath) : FileManager
181171
{
182172
$this->composerJsonPath = \str_replace('\\', '/', $composerJsonPath);
@@ -196,6 +186,16 @@ public function setConfigName(string $dirOrFilename) : FileManager
196186
return $this;
197187
}
198188

189+
/**
190+
* Set file extension for saving index file
191+
*/
192+
public function setExtension(string $extension = '.serial') : self
193+
{
194+
$this->extension = $extension;
195+
196+
return $this;
197+
}
198+
199199
private function getSerializedName(string $fileName = '', string $extension = '') : string
200200
{
201201
$file = $this->configFile;

src/PHPFUI/InstaDoc/MarkDownParser.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function __construct()
1616

1717
public function fileText(string $filename) : string
1818
{
19-
$markdown = @\file_get_contents($filename);
19+
$markdown = \file_exists($filename) ? \file_get_contents($filename) : '';
2020

2121
return $this->text($markdown);
2222
}

src/PHPFUI/InstaDoc/PageInterface.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ public function addBody(mixed $item) : PageInterface;
1212

1313
public function create(\PHPFUI\Menu $menu) : void;
1414

15+
public static function setDebug(int $level = 0) : void;
16+
1517
public function setGenerating(string $generating) : PageInterface;
1618

1719
public function setHomeUrl(string $url) : PageInterface;
18-
19-
public static function setDebug(int $level = 0) : void;
2020
}

0 commit comments

Comments
 (0)