Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
yii2
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
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
PSDI Army
yii2
Commits
6405c4f3
Commit
6405c4f3
authored
Aug 28, 2013
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
added proper word wrapping and note about read/writeonly properties
parent
c5b42910
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
11 deletions
+26
-11
PhpDocController.php
build/controllers/PhpDocController.php
+26
-11
No files found.
build/controllers/PhpDocController.php
View file @
6405c4f3
...
@@ -82,7 +82,7 @@ class PhpDocController extends Controller
...
@@ -82,7 +82,7 @@ class PhpDocController extends Controller
}
}
if
(
!
$ref
->
isSubclassOf
(
'yii\base\Object'
)
&&
$className
!=
'yii\base\Object'
)
{
if
(
!
$ref
->
isSubclassOf
(
'yii\base\Object'
)
&&
$className
!=
'yii\base\Object'
)
{
$this
->
stderr
(
"[INFO] Skipping class
$className
as it is not a subclass of yii
\\
base
\\
Object
\n
"
,
Console
::
FG_BLUE
,
Console
::
BOLD
);
$this
->
stderr
(
"[INFO] Skipping class
$className
as it is not a subclass of yii
\\
base
\\
Object
.
\n
"
,
Console
::
FG_BLUE
,
Console
::
BOLD
);
return
false
;
return
false
;
}
}
...
@@ -92,7 +92,11 @@ class PhpDocController extends Controller
...
@@ -92,7 +92,11 @@ class PhpDocController extends Controller
$seenSince
=
false
;
$seenSince
=
false
;
$seenAuthor
=
false
;
$seenAuthor
=
false
;
// TODO move these checks to different action
$lines
=
explode
(
"
\n
"
,
$newDoc
);
$lines
=
explode
(
"
\n
"
,
$newDoc
);
if
(
trim
(
$lines
[
1
])
==
'*'
||
substr
(
trim
(
$lines
[
1
]),
0
,
3
)
==
'* @'
)
{
$this
->
stderr
(
"[WARN] Class
$className
has no short description.
\n
"
,
Console
::
FG_YELLOW
,
Console
::
BOLD
);
}
foreach
(
$lines
as
$line
)
{
foreach
(
$lines
as
$line
)
{
if
(
substr
(
trim
(
$line
),
0
,
9
)
==
'* @since '
)
{
if
(
substr
(
trim
(
$line
),
0
,
9
)
==
'* @since '
)
{
$seenSince
=
true
;
$seenSince
=
true
;
...
@@ -218,11 +222,11 @@ class PhpDocController extends Controller
...
@@ -218,11 +222,11 @@ class PhpDocController extends Controller
$className
=
$namespace
.
'\\'
.
$class
[
'name'
];
$className
=
$namespace
.
'\\'
.
$class
[
'name'
];
$gets
=
$this
->
match
(
$gets
=
$this
->
match
(
'#\* @return (?<type>
\w
+)(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/'
.
'#\* @return (?<type>
[\w\\|\\\\]
+)(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/'
.
'[\s\n]{2,}public function (?<kind>get)(?<name>\w+)\((?:,? ?\$\w+ ?= ?[^,]+)*\)#'
,
'[\s\n]{2,}public function (?<kind>get)(?<name>\w+)\((?:,? ?\$\w+ ?= ?[^,]+)*\)#'
,
$class
[
'content'
]);
$class
[
'content'
]);
$sets
=
$this
->
match
(
$sets
=
$this
->
match
(
'#\* @param (?<type>
\w
+) \$\w+(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/'
.
'#\* @param (?<type>
[\w\\|\\\\]
+) \$\w+(?: (?<comment>(?:(?!\*/|\* @).)+?)(?:(?!\*/).)+|[\s\n]*)\*/'
.
'[\s\n]{2,}public function (?<kind>set)(?<name>\w+)\(\$\w+(?:, ?\$\w+ ?= ?[^,]+)*\)#'
,
'[\s\n]{2,}public function (?<kind>set)(?<name>\w+)\(\$\w+(?:, ?\$\w+ ?= ?[^,]+)*\)#'
,
$class
[
'content'
]);
$class
[
'content'
]);
$acrs
=
array_merge
(
$gets
,
$sets
);
$acrs
=
array_merge
(
$gets
,
$sets
);
...
@@ -247,14 +251,25 @@ class PhpDocController extends Controller
...
@@ -247,14 +251,25 @@ class PhpDocController extends Controller
if
(
count
(
$props
)
>
0
)
{
if
(
count
(
$props
)
>
0
)
{
$phpdoc
.=
" *
\n
"
;
$phpdoc
.=
" *
\n
"
;
foreach
(
$props
as
$propName
=>
&
$prop
)
{
foreach
(
$props
as
$propName
=>
&
$prop
)
{
$phpdoc
.=
' * @'
;
$docline
=
' * @'
;
// if (isset($prop['get']) && isset($prop['set'])) // Few IDEs support complex syntax
$docline
.=
'property'
;
// Do not use property-read and property-write as few IDEs support complex syntax.
$phpdoc
.=
'property'
;
if
(
isset
(
$prop
[
'get'
])
&&
isset
(
$prop
[
'set'
]))
{
// elseif (isset($prop['get']))
$note
=
''
;
// $phpdoc .= 'property-read';
}
elseif
(
isset
(
$prop
[
'get'
]))
{
// elseif (isset($prop['set']))
$note
=
' This property is read-only.'
;
// $phpdoc .= 'property-write';
// $docline .= '-read';
$phpdoc
.=
' '
.
$this
->
getPropParam
(
$prop
,
'type'
)
.
" $$propName "
.
$this
->
getPropParam
(
$prop
,
'comment'
)
.
"
\n
"
;
}
elseif
(
isset
(
$prop
[
'set'
]))
{
$note
=
' This property is write-only.'
;
// $docline .= '-write';
}
$docline
.=
' '
.
$this
->
getPropParam
(
$prop
,
'type'
)
.
" $$propName "
;
$comment
=
explode
(
"
\n
"
,
$this
->
getPropParam
(
$prop
,
'comment'
)
.
$note
);
foreach
(
$comment
as
&
$cline
)
{
$cline
=
ltrim
(
$cline
,
'* '
);
}
$docline
=
wordwrap
(
$docline
.
implode
(
' '
,
$comment
),
110
,
"
\n
* "
)
.
"
\n
"
;
$phpdoc
.=
$docline
;
}
}
$phpdoc
.=
" *
\n
"
;
$phpdoc
.=
" *
\n
"
;
}
}
...
...
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