Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
S
sidekick
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Privat - Marco Schmiedel
sidekick
Commits
9b855a9d
Commit
9b855a9d
authored
Dec 23, 2021
by
Marco Schmiedel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix beautifier class regex
parent
fe26e9f0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
9 deletions
+9
-9
CodebeautifierCommand.php
src/Commands/CodebeautifierCommand/CodebeautifierCommand.php
+2
-2
BeautifyManager.php
src/Managers/BeautifyManager/BeautifyManager.php
+7
-7
No files found.
src/Commands/CodebeautifierCommand/CodebeautifierCommand.php
View file @
9b855a9d
...
@@ -10,7 +10,7 @@
...
@@ -10,7 +10,7 @@
| sidekick package.
| sidekick package.
|
|
| Author: Marco Schmiedel <marco.schmiedel@itmax.email>
| Author: Marco Schmiedel <marco.schmiedel@itmax.email>
| Date: 2021-12-23
19:50:42
| Date: 2021-12-23
20:30:33
|
|
*/
*/
namespace
Ceetrox\Commands\CodebeautifierCommand
;
namespace
Ceetrox\Commands\CodebeautifierCommand
;
...
@@ -71,7 +71,7 @@
...
@@ -71,7 +71,7 @@
|------------------------------------------------------------------------------------
|------------------------------------------------------------------------------------
| Drop error for a wrong file path.
| Drop error for a wrong file path.
*/
*/
$file
=
$this
->
error
(
'Please enter a valid
file path
!'
);
$file
=
$this
->
error
(
'Please enter a valid
path to a php class
!'
);
/*
/*
|------------------------------------------------------------------------------------
|------------------------------------------------------------------------------------
...
...
src/Managers/BeautifyManager/BeautifyManager.php
View file @
9b855a9d
...
@@ -215,19 +215,19 @@
...
@@ -215,19 +215,19 @@
|----------------------------------------------------------------------------------------
|----------------------------------------------------------------------------------------
| start Pattern
| start Pattern
*/
*/
$
OpenPattern
=
'/[^
;{}$*"]+class[^a-z\\\[(=-][^{;()[\]]+/s'
;
$
openPattern
=
'/[^A-Za-z]+[^(A-Za-z0-9)
;{}$*"]+class[^a-z\\\[(=-][^{;()[\]]+/s'
;
/*
/*
|----------------------------------------------------------------------------------------
|----------------------------------------------------------------------------------------
| stop Pattern
| stop Pattern
*/
*/
$
ClosePattern
=
'/([^
;{$}>*$()"]+\s*class[^a-z\\[(=-])|[\s\t\n]+$/'
;
$
closePattern
=
'/([^A-Za-z]+[^(A-Za-z0-9)
;{$}>*$()"]+\s*class[^a-z\\[(=-])|[\s\t\n]+$/'
;
/*
/*
|----------------------------------------------------------------------------------------
|----------------------------------------------------------------------------------------
| extract inbetween
| extract inbetween
*/
*/
$classes
=
$this
->
matchBetweenTwoPatterns
(
$this
->
content
,
$
OpenPattern
,
$C
losePattern
);
$classes
=
$this
->
matchBetweenTwoPatterns
(
$this
->
content
,
$
openPattern
,
$c
losePattern
);
/*
/*
|----------------------------------------------------------------------------------------
|----------------------------------------------------------------------------------------
...
@@ -318,16 +318,16 @@
...
@@ -318,16 +318,16 @@
$Classstart
=
strpos
(
$Class
[
'Body'
]
,
'{'
)
+
1
;
$Classstart
=
strpos
(
$Class
[
'Body'
]
,
'{'
)
+
1
;
$Classstop
=
strrpos
(
$Class
[
'Body'
]
,
'}'
);
$Classstop
=
strrpos
(
$Class
[
'Body'
]
,
'}'
);
$ClassCount
=
strlen
(
$Class
[
'Body'
]);
$ClassCount
=
strlen
(
$Class
[
'Body'
]);
$
P
repared
=
substr
(
$Class
[
'Body'
],
$Classstart
,
(
$ClassCount
-
$Classstart
)
-
(
$ClassCount
-
$Classstop
))
;
$
p
repared
=
substr
(
$Class
[
'Body'
],
$Classstart
,
(
$ClassCount
-
$Classstart
)
-
(
$ClassCount
-
$Classstop
))
;
/*
/*
|------------------------------------------------------------------------------------
|------------------------------------------------------------------------------------
| Similar to extracting the classes, a start and stopPattern is defined for the
| Similar to extracting the classes, a start and stopPattern is defined for the
| methods. The methods are extracted between these regular expressions.
| methods. The methods are extracted between these regular expressions.
*/
*/
$
O
penPattern
=
'/([^;{}]+function[^a-z\\\[(][^{;()[\]]+)/'
;
$
o
penPattern
=
'/([^;{}]+function[^a-z\\\[(][^{;()[\]]+)/'
;
$
C
losePattern
=
'/([^;{$}>\'"*]+\s*function[^a-z\\[(])|[\s\t\n]+$/'
;
$
c
losePattern
=
'/([^;{$}>\'"*]+\s*function[^a-z\\[(])|[\s\t\n]+$/'
;
$results
=
$this
->
matchBetweenTwoPatterns
(
$
Prepared
,
$OpenPattern
,
$C
losePattern
);
$results
=
$this
->
matchBetweenTwoPatterns
(
$
prepared
,
$openPattern
,
$c
losePattern
);
/*
/*
|------------------------------------------------------------------------------------
|------------------------------------------------------------------------------------
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment