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
85f49e0c
Commit
85f49e0c
authored
May 25, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed apidoc short description
fixes #2797
parent
e3ee1b07
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
27 additions
and
17 deletions
+27
-17
BaseDoc.php
extensions/apidoc/models/BaseDoc.php
+16
-0
Context.php
extensions/apidoc/models/Context.php
+2
-4
EventDoc.php
extensions/apidoc/models/EventDoc.php
+1
-5
PropertyDoc.php
extensions/apidoc/models/PropertyDoc.php
+1
-5
seeAlso.php
extensions/apidoc/templates/html/views/seeAlso.php
+3
-1
type.php
extensions/apidoc/templates/html/views/type.php
+4
-2
No files found.
extensions/apidoc/models/BaseDoc.php
View file @
85f49e0c
...
@@ -127,4 +127,20 @@ class BaseDoc extends Object
...
@@ -127,4 +127,20 @@ class BaseDoc extends Object
// $lines = file(YII_PATH . $this->sourcePath);
// $lines = file(YII_PATH . $this->sourcePath);
// return implode("", array_slice($lines, $this->startLine - 1, $this->endLine - $this->startLine + 1));
// return implode("", array_slice($lines, $this->startLine - 1, $this->endLine - $this->startLine + 1));
// }
// }
public
static
function
extractFirstSentence
(
$text
)
{
if
(
mb_strlen
(
$text
)
>
4
&&
(
$pos
=
mb_strpos
(
$text
,
'.'
,
4
,
'utf-8'
))
!==
false
)
{
$sentence
=
mb_substr
(
$text
,
0
,
$pos
+
1
,
'utf-8'
);
if
(
mb_strlen
(
$text
)
>=
$pos
+
3
)
{
$abbrev
=
mb_substr
(
$text
,
$pos
-
1
,
4
);
if
(
$abbrev
===
'e.g.'
||
$abbrev
===
'i.e.'
)
{
// do not break sentence after abbreviation
$sentence
.=
static
::
extractFirstSentence
(
mb_substr
(
$text
,
$pos
+
1
));
}
}
return
$sentence
;
}
else
{
return
$text
;
}
}
}
}
extensions/apidoc/models/Context.php
View file @
85f49e0c
...
@@ -289,8 +289,7 @@ class Context extends Component
...
@@ -289,8 +289,7 @@ class Context extends Component
'isStatic'
=>
false
,
'isStatic'
=>
false
,
'type'
=>
$method
->
returnType
,
'type'
=>
$method
->
returnType
,
'types'
=>
$method
->
returnTypes
,
'types'
=>
$method
->
returnTypes
,
'shortDescription'
=>
((
$pos
=
strpos
(
$method
->
return
,
'.'
))
!==
false
)
?
'shortDescription'
=>
BaseDoc
::
extractFirstSentence
(
$method
->
return
),
substr
(
$method
->
return
,
0
,
$pos
)
:
$method
->
return
,
'description'
=>
$method
->
return
,
'description'
=>
$method
->
return
,
'getter'
=>
$method
'getter'
=>
$method
// TODO set default value
// TODO set default value
...
@@ -319,8 +318,7 @@ class Context extends Component
...
@@ -319,8 +318,7 @@ class Context extends Component
'isStatic'
=>
false
,
'isStatic'
=>
false
,
'type'
=>
$param
->
type
,
'type'
=>
$param
->
type
,
'types'
=>
$param
->
types
,
'types'
=>
$param
->
types
,
'shortDescription'
=>
((
$pos
=
strpos
(
$param
->
description
,
'.'
))
!==
false
)
?
'shortDescription'
=>
BaseDoc
::
extractFirstSentence
(
$param
->
description
),
substr
(
$param
->
description
,
0
,
$pos
)
:
$param
->
description
,
'description'
=>
$param
->
description
,
'description'
=>
$param
->
description
,
'setter'
=>
$method
'setter'
=>
$method
]);
]);
...
...
extensions/apidoc/models/EventDoc.php
View file @
85f49e0c
...
@@ -39,11 +39,7 @@ class EventDoc extends ConstDoc
...
@@ -39,11 +39,7 @@ class EventDoc extends ConstDoc
$this
->
type
=
$eventTag
->
getType
();
$this
->
type
=
$eventTag
->
getType
();
$this
->
types
=
$eventTag
->
getTypes
();
$this
->
types
=
$eventTag
->
getTypes
();
$this
->
description
=
ucfirst
(
$eventTag
->
getDescription
());
$this
->
description
=
ucfirst
(
$eventTag
->
getDescription
());
if
((
$pos
=
strpos
(
$this
->
description
,
'.'
))
!==
false
)
{
$this
->
shortDescription
=
BaseDoc
::
extractFirstSentence
(
$this
->
description
);
$this
->
shortDescription
=
substr
(
$this
->
description
,
0
,
$pos
);
}
else
{
$this
->
shortDescription
=
$this
->
description
;
}
unset
(
$this
->
tags
[
$i
]);
unset
(
$this
->
tags
[
$i
]);
}
}
}
}
...
...
extensions/apidoc/models/PropertyDoc.php
View file @
85f49e0c
...
@@ -72,11 +72,7 @@ class PropertyDoc extends BaseDoc
...
@@ -72,11 +72,7 @@ class PropertyDoc extends BaseDoc
$this
->
type
=
$tag
->
getType
();
$this
->
type
=
$tag
->
getType
();
$this
->
types
=
$tag
->
getTypes
();
$this
->
types
=
$tag
->
getTypes
();
$this
->
description
=
ucfirst
(
$tag
->
getDescription
());
$this
->
description
=
ucfirst
(
$tag
->
getDescription
());
if
((
$pos
=
strpos
(
$this
->
description
,
'.'
))
!==
false
)
{
$this
->
shortDescription
=
BaseDoc
::
extractFirstSentence
(
$this
->
description
);
$this
->
shortDescription
=
substr
(
$this
->
description
,
0
,
$pos
+
1
);
}
else
{
$this
->
shortDescription
=
$this
->
description
;
}
}
}
}
}
if
(
empty
(
$this
->
shortDescription
)
&&
$context
!==
null
&&
!
$hasInheritdoc
)
{
if
(
empty
(
$this
->
shortDescription
)
&&
$context
!==
null
&&
!
$hasInheritdoc
)
{
...
...
extensions/apidoc/templates/html/views/seeAlso.php
View file @
85f49e0c
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
* @var yii\web\View $this
* @var yii\web\View $this
*/
*/
$type
=
$object
instanceof
\yii\apidoc\models\TypeDoc
?
$object
:
$object
->
definedBy
;
$see
=
[];
$see
=
[];
foreach
(
$object
->
tags
as
$tag
)
{
foreach
(
$object
->
tags
as
$tag
)
{
/** @var $tag phpDocumentor\Reflection\DocBlock\Tag\SeeTag */
/** @var $tag phpDocumentor\Reflection\DocBlock\Tag\SeeTag */
...
@@ -13,7 +15,7 @@ foreach ($object->tags as $tag) {
...
@@ -13,7 +15,7 @@ foreach ($object->tags as $tag) {
if
(
strpos
(
$ref
,
'://'
)
===
false
)
{
if
(
strpos
(
$ref
,
'://'
)
===
false
)
{
$ref
=
'[['
.
$ref
.
']]'
;
$ref
=
'[['
.
$ref
.
']]'
;
}
}
$see
[]
=
rtrim
(
\yii\apidoc\helpers\ApiMarkdown
::
process
(
$ref
.
' '
.
$tag
->
getDescription
(),
$
object
->
definedBy
,
true
),
".
\r\n
"
);
$see
[]
=
rtrim
(
\yii\apidoc\helpers\ApiMarkdown
::
process
(
$ref
.
' '
.
$tag
->
getDescription
(),
$
type
,
true
),
".
\r\n
"
);
}
}
}
}
if
(
empty
(
$see
))
{
if
(
empty
(
$see
))
{
...
...
extensions/apidoc/templates/html/views/type.php
View file @
85f49e0c
...
@@ -80,8 +80,10 @@ $renderer = $this->context;
...
@@ -80,8 +80,10 @@ $renderer = $this->context;
</table>
</table>
<div
id=
"classDescription"
>
<div
id=
"classDescription"
>
<strong>
<?=
ApiMarkdown
::
process
(
$type
->
shortDescription
,
$type
,
true
)
?>
</strong>
<p><strong>
<?=
ApiMarkdown
::
process
(
$type
->
shortDescription
,
$type
,
true
)
?>
</strong></p>
<p>
<?=
ApiMarkdown
::
process
(
$type
->
description
,
$type
)
?>
</p>
<?=
ApiMarkdown
::
process
(
$type
->
description
,
$type
)
?>
<?=
$this
->
render
(
'seeAlso'
,
[
'object'
=>
$type
])
?>
</div>
</div>
<a
name=
"properties"
></a>
<a
name=
"properties"
></a>
...
...
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