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
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Rotua Panjaitan
yii2
Commits
8495be76
Commit
8495be76
authored
Jan 05, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
renamed item -> type
parent
b4944934
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
130 additions
and
143 deletions
+130
-143
OfflineRenderer.php
extensions/yii/apidoc/components/OfflineRenderer.php
+13
-13
class.php
extensions/yii/apidoc/views/class.php
+0
-61
classSummary.php
extensions/yii/apidoc/views/classSummary.php
+0
-50
constSummary.php
extensions/yii/apidoc/views/constSummary.php
+4
-4
eventSummary.php
extensions/yii/apidoc/views/eventSummary.php
+4
-4
index.php
extensions/yii/apidoc/views/index.php
+3
-3
methodSummary.php
extensions/yii/apidoc/views/methodSummary.php
+4
-4
propertySummary.php
extensions/yii/apidoc/views/propertySummary.php
+4
-4
type.php
extensions/yii/apidoc/views/type.php
+98
-0
No files found.
extensions/yii/apidoc/components/OfflineRenderer.php
View file @
8495be76
...
...
@@ -28,7 +28,7 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
public
$targetDir
;
public
$layout
=
'@yii/apidoc/views/layouts/offline.php'
;
public
$
itemView
=
'@yii/apidoc/views/class
.php'
;
public
$
typeView
=
'@yii/apidoc/views/type
.php'
;
public
$indexView
=
'@yii/apidoc/views/index.php'
;
public
$pageTitle
=
'Yii Framework 2.0 API Documentation'
;
...
...
@@ -50,24 +50,24 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
mkdir
(
$dir
);
}
$
item
s
=
array_merge
(
$context
->
classes
,
$context
->
interfaces
,
$context
->
traits
);
$
itemCount
=
count
(
$item
s
)
+
1
;
Console
::
startProgress
(
0
,
$
item
Count
,
'Rendering files: '
,
false
);
$
type
s
=
array_merge
(
$context
->
classes
,
$context
->
interfaces
,
$context
->
traits
);
$
typeCount
=
count
(
$type
s
)
+
1
;
Console
::
startProgress
(
0
,
$
type
Count
,
'Rendering files: '
,
false
);
$done
=
0
;
foreach
(
$
items
as
$item
)
{
$fileContent
=
$this
->
renderWithLayout
(
$this
->
item
View
,
[
'
item'
=>
$item
,
foreach
(
$
types
as
$type
)
{
$fileContent
=
$this
->
renderWithLayout
(
$this
->
type
View
,
[
'
type'
=>
$type
,
'docContext'
=>
$context
,
]);
file_put_contents
(
$dir
.
'/'
.
$this
->
generateFileName
(
$
item
->
name
),
$fileContent
);
Console
::
updateProgress
(
++
$done
,
$
item
Count
);
file_put_contents
(
$dir
.
'/'
.
$this
->
generateFileName
(
$
type
->
name
),
$fileContent
);
Console
::
updateProgress
(
++
$done
,
$
type
Count
);
}
$indexFileContent
=
$this
->
renderWithLayout
(
$this
->
indexView
,
[
'docContext'
=>
$context
,
'
items'
=>
$item
s
,
'
types'
=>
$type
s
,
]);
file_put_contents
(
$dir
.
'/index.html'
,
$indexFileContent
);
Console
::
updateProgress
(
++
$done
,
$
item
Count
);
Console
::
updateProgress
(
++
$done
,
$
type
Count
);
Console
::
endProgress
(
true
);
$controller
->
stdout
(
'done.'
.
PHP_EOL
,
Console
::
FG_GREEN
);
...
...
@@ -209,9 +209,9 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
}
public
function
generateFileName
(
$
item
Name
)
public
function
generateFileName
(
$
type
Name
)
{
return
strtolower
(
str_replace
(
'\\'
,
'_'
,
$
item
Name
))
.
'.html'
;
return
strtolower
(
str_replace
(
'\\'
,
'_'
,
$
type
Name
))
.
'.html'
;
}
/**
...
...
extensions/yii/apidoc/views/class.php
deleted
100644 → 0
View file @
b4944934
<?php
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\TraitDoc
;
/**
* @var ClassDoc|InterfaceDoc|TraitDoc $item
* @var yii\web\View $this
*/
?>
<h1>
<?php
if
(
$item
instanceof
InterfaceDoc
)
{
echo
'Interface '
;
}
elseif
(
$item
instanceof
TraitDoc
)
{
echo
'Trait '
;
}
else
{
if
(
$item
->
isFinal
)
{
echo
'Final '
;
}
if
(
$item
->
isAbstract
)
{
echo
'Abstract '
;
}
echo
'Class '
;
}
echo
$item
->
name
;
?>
</h1>
<div
id=
"nav"
>
<a
href=
"index.html"
>
All Classes
</a>
<?php
if
(
!
(
$item
instanceof
InterfaceDoc
)
&&
!
empty
(
$item
->
properties
))
:
?>
|
<a
href=
"#properties"
>
Properties
</a>
<?php
endif
;
?>
<?php
if
(
!
empty
(
$item
->
methods
))
:
?>
|
<a
href=
"#methods"
>
Methods
</a>
<?php
endif
;
?>
<?php
if
(
$item
instanceof
ClassDoc
&&
!
empty
(
$item
->
events
))
:
?>
|
<a
href=
"#events"
>
Events
</a>
<?php
endif
;
?>
<?php
if
(
$item
instanceof
ClassDoc
&&
!
empty
(
$item
->
constants
))
:
?>
|
<a
href=
"#constants"
>
Constants
</a>
<?php
endif
;
?>
</div>
<?=
$this
->
render
(
'classSummary'
,
[
'item'
=>
$item
])
?>
<a
name=
"properties"
></a>
<?=
$this
->
render
(
'propertySummary'
,
[
'item'
=>
$item
,
'protected'
=>
false
])
?>
<?=
$this
->
render
(
'propertySummary'
,
[
'item'
=>
$item
,
'protected'
=>
true
])
?>
<a
name=
"methods"
></a>
<?=
$this
->
render
(
'methodSummary'
,
[
'item'
=>
$item
,
'protected'
=>
false
])
?>
<?=
$this
->
render
(
'methodSummary'
,
[
'item'
=>
$item
,
'protected'
=>
true
])
?>
<a
name=
"events"
></a>
<?=
$this
->
render
(
'eventSummary'
,
[
'item'
=>
$item
])
?>
<a
name=
"constants"
></a>
<?=
$this
->
render
(
'constSummary'
,
[
'item'
=>
$item
])
?>
<?php
//$this->renderPartial('propertyDetails',array('class'=>$item)); ?>
<?
php
//$this->renderPartial('methodDetails',array('class'=>$item)); ?>
extensions/yii/apidoc/views/classSummary.php
deleted
100644 → 0
View file @
b4944934
<?php
use
yii\apidoc\components\OfflineRenderer
;
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\TraitDoc
;
/**
* @var ClassDoc|InterfaceDoc|TraitDoc $item
* @var yii\web\View $this
* @var OfflineRenderer $renderer
*/
$renderer
=
$this
->
context
;
?>
<table
class=
"summaryTable docClass"
>
<colgroup>
<col
class=
"col-name"
/>
<col
class=
"col-value"
/>
</colgroup>
<?php
if
(
$item
instanceof
ClassDoc
)
:
?>
<tr><th>
Inheritance
</th><td>
<?=
$renderer
->
renderInheritance
(
$item
)
?>
</td></tr>
<?php
endif
;
?>
<?php
if
(
$item
instanceof
ClassDoc
&&
!
empty
(
$item
->
interfaces
))
:
?>
<tr><th>
Implements
</th><td>
<?=
$renderer
->
renderInterfaces
(
$item
->
interfaces
)
?>
</td></tr>
<?php
endif
;
?>
<?php
if
(
!
(
$item
instanceof
InterfaceDoc
)
&&
!
empty
(
$item
->
traits
))
:
?>
<tr><th>
Uses Traits
</th><td>
<?=
$renderer
->
renderTraits
(
$item
->
traits
)
?>
</td></tr>
<?php
endif
;
?>
<?php
if
(
$item
instanceof
ClassDoc
&&
!
empty
(
$item
->
subclasses
))
:
?>
<tr><th>
Subclasses
</th><td>
<?=
$renderer
->
renderClasses
(
$item
->
subclasses
)
?>
</td></tr>
<?php
endif
;
?>
<?php
if
(
$item
instanceof
InterfaceDoc
&&
!
empty
(
$item
->
implementedBy
))
:
?>
<tr><th>
Implemented by
</th><td>
<?=
$renderer
->
renderClasses
(
$item
->
implementedBy
)
?>
</td></tr>
<?php
endif
;
?>
<?php
if
(
$item
instanceof
TraitDoc
&&
!
empty
(
$item
->
usedBy
))
:
?>
<tr><th>
Implemented by
</th><td>
<?=
$renderer
->
renderClasses
(
$item
->
usedBy
)
?>
</td></tr>
<?php
endif
;
?>
<?php
if
(
!
empty
(
$item
->
since
))
:
?>
<tr><th>
Available since version
</th><td>
<?=
$item
->
since
?>
</td></tr>
<?php
endif
;
?>
<tr>
<th>
Source Code
</th>
<td>
<?php
// TODO echo $this->renderSourceLink($item->sourcePath) ?></td>
</
tr
>
</
table
>
<
div
id
=
"classDescription"
>
<
strong
><?=
$item
->
shortDescription
?>
</strong>
<p>
<?=
nl2br
(
$item
->
description
)
?>
</p>
</div>
\ No newline at end of file
extensions/yii/apidoc/views/constSummary.php
View file @
8495be76
...
...
@@ -2,11 +2,11 @@
use
yii\apidoc\models\ClassDoc
;
/**
* @var ClassDoc $
item
* @var ClassDoc $
type
* @var yii\web\View $this
*/
if
(
empty
(
$
item
->
constants
))
{
if
(
empty
(
$
type
->
constants
))
{
return
;
}
?>
<div
class=
"summary docConst"
>
...
...
@@ -23,8 +23,8 @@ if (empty($item->constants)) {
<tr>
<th>
Constant
</th><th>
Description
</th><th>
Defined By
</th>
</tr>
<?php
foreach
(
$
item
->
constants
as
$constant
)
:
?>
<tr
<?=
$constant
->
definedBy
!=
$
item
->
name
?
' class="inherited"'
:
''
?>
id=
"
<?=
$constant
->
name
?>
"
>
<?php
foreach
(
$
type
->
constants
as
$constant
)
:
?>
<tr
<?=
$constant
->
definedBy
!=
$
type
->
name
?
' class="inherited"'
:
''
?>
id=
"
<?=
$constant
->
name
?>
"
>
<td>
<?=
$this
->
context
->
subjectLink
(
$constant
)
?>
</td>
<td>
<?=
$constant
->
shortDescription
?>
</td>
<td>
<?=
$this
->
context
->
typeLink
(
$constant
->
definedBy
)
?>
</td>
...
...
extensions/yii/apidoc/views/eventSummary.php
View file @
8495be76
...
...
@@ -2,11 +2,11 @@
use
yii\apidoc\models\ClassDoc
;
/**
* @var ClassDoc $
item
* @var ClassDoc $
type
* @var yii\web\View $this
*/
if
(
empty
(
$
item
->
events
))
{
if
(
empty
(
$
type
->
events
))
{
return
;
}
?>
<div
class=
"summary docEvent"
>
...
...
@@ -23,8 +23,8 @@ if (empty($item->events)) {
<tr>
<th>
Event
</th><th>
Description
</th><th>
Defined By
</th>
</tr>
<?php
foreach
(
$
item
->
events
as
$event
)
:
?>
<tr
<?=
$event
->
definedBy
!=
$
item
->
name
?
' class="inherited"'
:
''
?>
id=
"
<?=
$event
->
name
?>
"
>
<?php
foreach
(
$
type
->
events
as
$event
)
:
?>
<tr
<?=
$event
->
definedBy
!=
$
type
->
name
?
' class="inherited"'
:
''
?>
id=
"
<?=
$event
->
name
?>
"
>
<td>
<?=
$this
->
context
->
subjectLink
(
$event
)
?>
</td>
<td>
<?=
$event
->
shortDescription
?>
</td>
<td>
<?=
$this
->
context
->
typeLink
(
$event
->
definedBy
)
?>
</td>
...
...
extensions/yii/apidoc/views/index.php
View file @
8495be76
...
...
@@ -4,7 +4,7 @@ use yii\apidoc\models\ClassDoc;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\TraitDoc
;
/**
* @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $
item
s
* @var ClassDoc[]|InterfaceDoc[]|TraitDoc[] $
type
s
* @var yii\web\View $this
*/
...
...
@@ -20,8 +20,8 @@ use yii\apidoc\models\TraitDoc;
<th>
Class
</th><th>
Description
</th>
</tr>
<?php
ksort
(
$
item
s
);
foreach
(
$
item
s
as
$i
=>
$class
)
:
?>
ksort
(
$
type
s
);
foreach
(
$
type
s
as
$i
=>
$class
)
:
?>
<tr>
<td>
<?php
echo
$this
->
context
->
typeLink
(
$class
,
$class
->
name
);
?>
</td>
<td>
<?php
echo
$class
->
shortDescription
;
?>
</td>
...
...
extensions/yii/apidoc/views/methodSummary.php
View file @
8495be76
...
...
@@ -4,12 +4,12 @@ use yii\apidoc\models\ClassDoc;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\TraitDoc
;
/**
* @var ClassDoc|InterfaceDoc|TraitDoc $
item
* @var ClassDoc|InterfaceDoc|TraitDoc $
type
* @var boolean $protected
* @var yii\web\View $this
*/
if
(
$protected
&&
count
(
$
item
->
getProtectedMethods
())
==
0
||
!
$protected
&&
count
(
$item
->
getPublicMethods
())
==
0
)
{
if
(
$protected
&&
count
(
$
type
->
getProtectedMethods
())
==
0
||
!
$protected
&&
count
(
$type
->
getPublicMethods
())
==
0
)
{
return
;
}
?>
...
...
@@ -27,9 +27,9 @@ if ($protected && count($item->getProtectedMethods()) == 0 || !$protected && cou
<tr>
<th>
Method
</th><th>
Description
</th><th>
Defined By
</th>
</tr>
<?php
foreach
(
$
item
->
methods
as
$method
)
:
?>
<?php
foreach
(
$
type
->
methods
as
$method
)
:
?>
<?php
if
(
$protected
&&
$method
->
visibility
==
'protected'
||
!
$protected
&&
$method
->
visibility
!=
'protected'
)
:
?>
<tr
<?=
$method
->
definedBy
!=
$
item
->
name
?
' class="inherited"'
:
''
?>
id=
"
<?=
$method
->
name
?>
"
>
<tr
<?=
$method
->
definedBy
!=
$
type
->
name
?
' class="inherited"'
:
''
?>
id=
"
<?=
$method
->
name
?>
"
>
<td>
<?=
$this
->
context
->
subjectLink
(
$method
,
$method
->
name
.
'()'
)
?>
</td>
<td>
<?=
$method
->
shortDescription
?>
</td>
<td>
<?=
$this
->
context
->
typeLink
(
$method
->
definedBy
)
?>
</td>
...
...
extensions/yii/apidoc/views/propertySummary.php
View file @
8495be76
...
...
@@ -4,12 +4,12 @@ use yii\apidoc\models\ClassDoc;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\TraitDoc
;
/**
* @var ClassDoc|InterfaceDoc|TraitDoc $
item
* @var ClassDoc|InterfaceDoc|TraitDoc $
type
* @var boolean $protected
* @var yii\web\View $this
*/
if
(
$protected
&&
count
(
$
item
->
getProtectedProperties
())
==
0
||
!
$protected
&&
count
(
$item
->
getPublicProperties
())
==
0
)
{
if
(
$protected
&&
count
(
$
type
->
getProtectedProperties
())
==
0
||
!
$protected
&&
count
(
$type
->
getPublicProperties
())
==
0
)
{
return
;
}
?>
...
...
@@ -28,9 +28,9 @@ if ($protected && count($item->getProtectedProperties()) == 0 || !$protected &&
<tr>
<th>
Property
</th><th>
Type
</th><th>
Description
</th><th>
Defined By
</th>
</tr>
<?php
foreach
(
$
item
->
properties
as
$property
)
:
?>
<?php
foreach
(
$
type
->
properties
as
$property
)
:
?>
<?php
if
(
$protected
&&
$property
->
visibility
==
'protected'
||
!
$protected
&&
$property
->
visibility
!=
'protected'
)
:
?>
<tr
<?=
$property
->
definedBy
!=
$
item
->
name
?
' class="inherited"'
:
''
?>
id=
"
<?=
$property
->
name
?>
"
>
<tr
<?=
$property
->
definedBy
!=
$
type
->
name
?
' class="inherited"'
:
''
?>
id=
"
<?=
$property
->
name
?>
"
>
<td>
<?php
echo
$this
->
context
->
subjectLink
(
$property
);
?>
</td>
<td>
<?php
echo
$this
->
context
->
typeLink
(
$property
->
types
);
?>
</td>
<td>
<?php
echo
$property
->
shortDescription
;
?>
</td>
...
...
extensions/yii/apidoc/views/type.php
0 → 100644
View file @
8495be76
<?php
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\TraitDoc
;
/**
* @var ClassDoc|InterfaceDoc|TraitDoc $type
* @var yii\web\View $this
* @var \yii\apidoc\components\OfflineRenderer $renderer
*/
$renderer
=
$this
->
context
;
?>
<h1>
<?php
if
(
$type
instanceof
InterfaceDoc
)
{
echo
'Interface '
;
}
elseif
(
$type
instanceof
TraitDoc
)
{
echo
'Trait '
;
}
else
{
if
(
$type
->
isFinal
)
{
echo
'Final '
;
}
if
(
$type
->
isAbstract
)
{
echo
'Abstract '
;
}
echo
'Class '
;
}
echo
$type
->
name
;
?>
</h1>
<div
id=
"nav"
>
<a
href=
"index.html"
>
All Classes
</a>
<?php
if
(
!
(
$type
instanceof
InterfaceDoc
)
&&
!
empty
(
$type
->
properties
))
:
?>
|
<a
href=
"#properties"
>
Properties
</a>
<?php
endif
;
?>
<?php
if
(
!
empty
(
$type
->
methods
))
:
?>
|
<a
href=
"#methods"
>
Methods
</a>
<?php
endif
;
?>
<?php
if
(
$type
instanceof
ClassDoc
&&
!
empty
(
$type
->
events
))
:
?>
|
<a
href=
"#events"
>
Events
</a>
<?php
endif
;
?>
<?php
if
(
$type
instanceof
ClassDoc
&&
!
empty
(
$type
->
constants
))
:
?>
|
<a
href=
"#constants"
>
Constants
</a>
<?php
endif
;
?>
</div>
<table
class=
"summaryTable docClass"
>
<colgroup>
<col
class=
"col-name"
/>
<col
class=
"col-value"
/>
</colgroup>
<?php
if
(
$type
instanceof
ClassDoc
)
:
?>
<tr><th>
Inheritance
</th><td>
<?=
$renderer
->
renderInheritance
(
$type
)
?>
</td></tr>
<?php
endif
;
?>
<?php
if
(
$type
instanceof
ClassDoc
&&
!
empty
(
$type
->
interfaces
))
:
?>
<tr><th>
Implements
</th><td>
<?=
$renderer
->
renderInterfaces
(
$type
->
interfaces
)
?>
</td></tr>
<?php
endif
;
?>
<?php
if
(
!
(
$type
instanceof
InterfaceDoc
)
&&
!
empty
(
$type
->
traits
))
:
?>
<tr><th>
Uses Traits
</th><td>
<?=
$renderer
->
renderTraits
(
$type
->
traits
)
?>
</td></tr>
<?php
endif
;
?>
<?php
if
(
$type
instanceof
ClassDoc
&&
!
empty
(
$type
->
subclasses
))
:
?>
<tr><th>
Subclasses
</th><td>
<?=
$renderer
->
renderClasses
(
$type
->
subclasses
)
?>
</td></tr>
<?php
endif
;
?>
<?php
if
(
$type
instanceof
InterfaceDoc
&&
!
empty
(
$type
->
implementedBy
))
:
?>
<tr><th>
Implemented by
</th><td>
<?=
$renderer
->
renderClasses
(
$type
->
implementedBy
)
?>
</td></tr>
<?php
endif
;
?>
<?php
if
(
$type
instanceof
TraitDoc
&&
!
empty
(
$type
->
usedBy
))
:
?>
<tr><th>
Implemented by
</th><td>
<?=
$renderer
->
renderClasses
(
$type
->
usedBy
)
?>
</td></tr>
<?php
endif
;
?>
<?php
if
(
!
empty
(
$type
->
since
))
:
?>
<tr><th>
Available since version
</th><td>
<?=
$type
->
since
?>
</td></tr>
<?php
endif
;
?>
<tr>
<th>
Source Code
</th>
<td>
<?php
// TODO echo $this->renderSourceLink($type->sourcePath) ?></td>
</
tr
>
</
table
>
<
div
id
=
"classDescription"
>
<
strong
><?=
$type
->
shortDescription
?>
</strong>
<p>
<?=
nl2br
(
$type
->
description
)
?>
</p>
</div>
<a
name=
"properties"
></a>
<?=
$this
->
render
(
'propertySummary'
,
[
'type'
=>
$type
,
'protected'
=>
false
])
?>
<?=
$this
->
render
(
'propertySummary'
,
[
'type'
=>
$type
,
'protected'
=>
true
])
?>
<a
name=
"methods"
></a>
<?=
$this
->
render
(
'methodSummary'
,
[
'type'
=>
$type
,
'protected'
=>
false
])
?>
<?=
$this
->
render
(
'methodSummary'
,
[
'type'
=>
$type
,
'protected'
=>
true
])
?>
<a
name=
"events"
></a>
<?=
$this
->
render
(
'eventSummary'
,
[
'type'
=>
$type
])
?>
<a
name=
"constants"
></a>
<?=
$this
->
render
(
'constSummary'
,
[
'type'
=>
$type
])
?>
<?php
//$this->renderPartial('propertyDetails',array('type'=>$type)); ?>
<?
php
//$this->renderPartial('methodDetails',array('type'=>$type)); ?>
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