Commit 336a09ca authored by Marco Schmiedel's avatar Marco Schmiedel

fix beautifer variable commands

parent 9b855a9d
......@@ -10,7 +10,7 @@
| sidekick package.
|
| Author: Marco Schmiedel <marco.schmiedel@itmax.email>
| Date: 2021-12-23 19:59:15
| Date: 2021-12-23 21:21:03
|
*/
namespace Ceetrox\Managers\BeautifyManager;
......@@ -32,12 +32,34 @@
{
/*
|--------------------------------------------------------------------------------------------
| Variables
| Parameter
|--------------------------------------------------------------------------------------------
| This variable stores the content during the render process.
*/
var $content = [];
/*
|--------------------------------------------------------------------------------------------
| Parameter
|--------------------------------------------------------------------------------------------
| This variable stores the identified classes.
*/
var $classes = [];
/*
|--------------------------------------------------------------------------------------------
| Parameter
|--------------------------------------------------------------------------------------------
| This variable stores the identified comments.
*/
var $comments = [];
/*
|--------------------------------------------------------------------------------------------
| Parameter
|--------------------------------------------------------------------------------------------
| This is a working parameter for the renderer and contains the current line deph.
*/
var $linedeph = 1;
......@@ -215,13 +237,13 @@
|----------------------------------------------------------------------------------------
| start Pattern
*/
$openPattern = '/[^A-Za-z]+[^(A-Za-z0-9);{}$*"]+class[^a-z\\\[(=-][^{;()[\]]+/s';
$openPattern = '/[^A-Za-z:]+[^(A-Za-z0-9);{}$*"]+class[^a-z\\\[(=-][^{;()[\]]+/s';
/*
|----------------------------------------------------------------------------------------
| stop Pattern
*/
$closePattern = '/([^A-Za-z]+[^(A-Za-z0-9);{$}>*$()"]+\s*class[^a-z\\[(=-])|[\s\t\n]+$/';
$closePattern = '/([^A-Za-z:]+[^(A-Za-z0-9);{$}>*$()"]+\s*class[^a-z\\[(=-])|[\s\t\n]+$/';
/*
|----------------------------------------------------------------------------------------
......@@ -264,7 +286,7 @@
| A check is then carried out to determine whether class variables are available.
| These will be noted later or set to "false".
*/
$preg = preg_match_all('/(public|protected|private|var)\s*\$.*\;/', $Class, $variables, PREG_OFFSET_CAPTURE);
$preg = preg_match_all('/(#COMMENT.*|\R|\s)*(public|protected|private|var)\s*\$(.|\R)+?\;/', $Class, $variables, PREG_OFFSET_CAPTURE);
if(isset($variables[0]))
{
......@@ -557,18 +579,31 @@
*/
$this->linedeph++;
/*
|--------------------------------------------------------------------------------
| write title comment
*/
$classstream .= $this->writeComment('', 'Variables');
/*
|--------------------------------------------------------------------------------
| setup variables
*/
$classstream .= $this->s().implode("\n".$this->s(), $class['variables']);
$classstream .= "\n\n";
foreach($class['variables'] as $variable)
{
$lines = explode("\n",$variable);
foreach($lines as $line)
{
if(strlen($line) > 0)
{
if(substr($line, 0,8) == '#COMMENT')
{
$comment = $this->getCommentFromPregMatch('/#.+-.+-.+#/',$line );
$classstream .= $this->writeComment($comment, 'Parameter');
}
else
{
$classstream .= $this->s().$line."\n";
}
}
}
$classstream .= "\n";
}
/*
|--------------------------------------------------------------------------------
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment