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
f7e00887
Commit
f7e00887
authored
Jan 06, 2014
by
Carsten Brandt
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
restructured apidoc templates
parent
59825446
Hide whitespace changes
Inline
Side-by-side
Showing
32 changed files
with
244 additions
and
61 deletions
+244
-61
README.md
extensions/yii/apidoc/README.md
+11
-0
apidoc
extensions/yii/apidoc/apidoc
+1
-1
RenderController.php
extensions/yii/apidoc/commands/RenderController.php
+34
-3
BaseDoc.php
extensions/yii/apidoc/models/BaseDoc.php
+5
-0
ClassDoc.php
extensions/yii/apidoc/models/ClassDoc.php
+3
-1
ConstDoc.php
extensions/yii/apidoc/models/ConstDoc.php
+5
-0
Context.php
extensions/yii/apidoc/models/Context.php
+5
-1
EventDoc.php
extensions/yii/apidoc/models/EventDoc.php
+5
-0
FunctionDoc.php
extensions/yii/apidoc/models/FunctionDoc.php
+5
-0
InterfaceDoc.php
extensions/yii/apidoc/models/InterfaceDoc.php
+5
-0
MethodDoc.php
extensions/yii/apidoc/models/MethodDoc.php
+5
-0
ParamDoc.php
extensions/yii/apidoc/models/ParamDoc.php
+5
-0
PropertyDoc.php
extensions/yii/apidoc/models/PropertyDoc.php
+5
-0
TraitDoc.php
extensions/yii/apidoc/models/TraitDoc.php
+5
-0
TypeDoc.php
extensions/yii/apidoc/models/TypeDoc.php
+5
-0
BaseRenderer.php
extensions/yii/apidoc/templates/BaseRenderer.php
+14
-19
README.md
extensions/yii/apidoc/templates/html/README.md
+5
-0
Renderer.php
extensions/yii/apidoc/templates/html/Renderer.php
+66
-27
constSummary.php
extensions/yii/apidoc/templates/html/views/constSummary.php
+0
-0
eventDetails.php
extensions/yii/apidoc/templates/html/views/eventDetails.php
+0
-0
eventSummary.php
extensions/yii/apidoc/templates/html/views/eventSummary.php
+0
-0
methodDetails.php
extensions/yii/apidoc/templates/html/views/methodDetails.php
+0
-0
methodSummary.php
extensions/yii/apidoc/templates/html/views/methodSummary.php
+0
-0
propertyDetails.php
...sions/yii/apidoc/templates/html/views/propertyDetails.php
+0
-0
propertySummary.php
...sions/yii/apidoc/templates/html/views/propertySummary.php
+0
-0
seeAlso.php
extensions/yii/apidoc/templates/html/views/seeAlso.php
+0
-0
type.php
extensions/yii/apidoc/templates/html/views/type.php
+9
-9
Renderer.php
extensions/yii/apidoc/templates/offline/Renderer.php
+45
-0
api.css
extensions/yii/apidoc/templates/offline/assets/css/api.css
+0
-0
style.css
extensions/yii/apidoc/templates/offline/assets/css/style.css
+0
-0
index.php
extensions/yii/apidoc/templates/offline/views/index.php
+0
-0
offline.php
extensions/yii/apidoc/templates/offline/views/offline.php
+1
-0
No files found.
extensions/yii/apidoc/README.md
View file @
f7e00887
...
@@ -25,4 +25,14 @@ to the require section of your composer.json.
...
@@ -25,4 +25,14 @@ to the require section of your composer.json.
Usage
Usage
-----
-----
TDB
Creating your own templates
---------------------------
TDB
Using the model layer
---------------------
TDB
TDB
\ No newline at end of file
extensions/yii/apidoc/apidoc
View file @
f7e00887
...
@@ -32,7 +32,7 @@ foreach($yiiDirs as $dir) {
...
@@ -32,7 +32,7 @@ foreach($yiiDirs as $dir) {
}
}
}
}
if
(
!
class_exists
(
'Yii'
))
{
if
(
!
class_exists
(
'Yii'
))
{
echo
"
\n
The Yii Framework 2.0 does not seem to be installed. Try running composer install.
\n\n
"
;
echo
PHP_EOL
.
"The Yii Framework 2.0 does not seem to be installed. Try running composer install."
.
PHP_EOL
.
PHP_EOL
;
exit
(
1
);
exit
(
1
);
}
}
...
...
extensions/yii/apidoc/commands/RenderController.php
View file @
f7e00887
...
@@ -8,6 +8,8 @@
...
@@ -8,6 +8,8 @@
namespace
yii\apidoc\commands
;
namespace
yii\apidoc\commands
;
use
phpDocumentor\Reflection\FileReflector
;
use
phpDocumentor\Reflection\FileReflector
;
use
TokenReflection\ReflectionFile
;
use
yii\apidoc\templates\BaseRenderer
;
use
yii\console\Controller
;
use
yii\console\Controller
;
use
yii\helpers\Console
;
use
yii\helpers\Console
;
use
yii\helpers\FileHelper
;
use
yii\helpers\FileHelper
;
...
@@ -23,6 +25,8 @@ use Yii;
...
@@ -23,6 +25,8 @@ use Yii;
*/
*/
class
RenderController
extends
Controller
class
RenderController
extends
Controller
{
{
public
$template
=
'offline'
;
/**
/**
* Renders API documentation files
* Renders API documentation files
* @param array $sourceDirs
* @param array $sourceDirs
...
@@ -31,7 +35,7 @@ class RenderController extends Controller
...
@@ -31,7 +35,7 @@ class RenderController extends Controller
*/
*/
public
function
actionIndex
(
array
$sourceDirs
,
$targetDir
)
public
function
actionIndex
(
array
$sourceDirs
,
$targetDir
)
{
{
$targetDir
=
Yii
::
getAlias
(
$targetDir
);
$targetDir
=
rtrim
(
Yii
::
getAlias
(
$targetDir
),
'\\/'
);
if
(
is_dir
(
$targetDir
)
&&
!
$this
->
confirm
(
'TargetDirectory already exists. Overwrite?'
))
{
if
(
is_dir
(
$targetDir
)
&&
!
$this
->
confirm
(
'TargetDirectory already exists. Overwrite?'
))
{
return
2
;
return
2
;
}
}
...
@@ -39,6 +43,9 @@ class RenderController extends Controller
...
@@ -39,6 +43,9 @@ class RenderController extends Controller
mkdir
(
$targetDir
);
mkdir
(
$targetDir
);
}
}
$renderer
=
$this
->
findRenderer
();
$renderer
->
targetDir
=
$targetDir
;
$this
->
stdout
(
'Searching files to process... '
);
$this
->
stdout
(
'Searching files to process... '
);
$files
=
[];
$files
=
[];
foreach
(
$sourceDirs
as
$source
)
{
foreach
(
$sourceDirs
as
$source
)
{
...
@@ -88,11 +95,26 @@ class RenderController extends Controller
...
@@ -88,11 +95,26 @@ class RenderController extends Controller
$this
->
stdout
(
'done.'
.
PHP_EOL
,
Console
::
FG_GREEN
);
$this
->
stdout
(
'done.'
.
PHP_EOL
,
Console
::
FG_GREEN
);
// render models
// render models
$renderer
=
new
OfflineRenderer
();
$renderer
->
targetDir
=
$targetDir
;
$renderer
->
render
(
$context
,
$this
);
$renderer
->
render
(
$context
,
$this
);
}
}
/**
* @return BaseRenderer
*/
protected
function
findRenderer
()
{
$file
=
Yii
::
getAlias
(
'@yii/apidoc/templates/'
.
$this
->
template
.
'/Renderer.php'
);
$reflection
=
new
FileReflector
(
$file
,
true
);
$reflection
->
process
();
$classes
=
$reflection
->
getClasses
();
if
(
empty
(
$classes
))
{
$this
->
stderr
(
'Renderer not found.'
.
PHP_EOL
);
}
$rendererClass
=
reset
(
$classes
)
->
getName
();
require
(
$file
);
return
new
$rendererClass
();
}
protected
function
findFiles
(
$path
,
$except
=
[])
protected
function
findFiles
(
$path
,
$except
=
[])
{
{
$path
=
FileHelper
::
normalizePath
(
$path
);
$path
=
FileHelper
::
normalizePath
(
$path
);
...
@@ -115,4 +137,12 @@ class RenderController extends Controller
...
@@ -115,4 +137,12 @@ class RenderController extends Controller
];
];
return
FileHelper
::
findFiles
(
$path
,
$options
);
return
FileHelper
::
findFiles
(
$path
,
$options
);
}
}
/**
* @inheritdoc
*/
public
function
globalOptions
()
{
return
array_merge
(
parent
::
globalOptions
(),
[
'template'
]);
}
}
}
\ No newline at end of file
extensions/yii/apidoc/models/BaseDoc.php
View file @
f7e00887
...
@@ -11,6 +11,11 @@ use phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag;
...
@@ -11,6 +11,11 @@ use phpDocumentor\Reflection\DocBlock\Tag\DeprecatedTag;
use
phpDocumentor\Reflection\DocBlock\Tag\SinceTag
;
use
phpDocumentor\Reflection\DocBlock\Tag\SinceTag
;
use
yii\base\Object
;
use
yii\base\Object
;
/**
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
BaseDoc
extends
Object
class
BaseDoc
extends
Object
{
{
public
$name
;
public
$name
;
...
...
extensions/yii/apidoc/models/ClassDoc.php
View file @
f7e00887
...
@@ -8,7 +8,9 @@
...
@@ -8,7 +8,9 @@
namespace
yii\apidoc\models
;
namespace
yii\apidoc\models
;
/**
/**
* Class ClassDoc
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
*/
class
ClassDoc
extends
TypeDoc
class
ClassDoc
extends
TypeDoc
{
{
...
...
extensions/yii/apidoc/models/ConstDoc.php
View file @
f7e00887
...
@@ -7,6 +7,11 @@
...
@@ -7,6 +7,11 @@
namespace
yii\apidoc\models
;
namespace
yii\apidoc\models
;
/**
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
ConstDoc
extends
BaseDoc
class
ConstDoc
extends
BaseDoc
{
{
public
$definedBy
;
public
$definedBy
;
...
...
extensions/yii/apidoc/models/Context.php
View file @
f7e00887
...
@@ -7,11 +7,15 @@
...
@@ -7,11 +7,15 @@
namespace
yii\apidoc\models
;
namespace
yii\apidoc\models
;
use
phpDocumentor\Reflection\FileReflector
;
use
phpDocumentor\Reflection\FileReflector
;
use
yii\base\Component
;
use
yii\base\Component
;
use
yii\base\Exception
;
use
yii\base\Exception
;
/**
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
Context
extends
Component
class
Context
extends
Component
{
{
/**
/**
...
...
extensions/yii/apidoc/models/EventDoc.php
View file @
f7e00887
...
@@ -10,6 +10,11 @@ namespace yii\apidoc\models;
...
@@ -10,6 +10,11 @@ namespace yii\apidoc\models;
use
phpDocumentor\Reflection\DocBlock\Tag\ParamTag
;
use
phpDocumentor\Reflection\DocBlock\Tag\ParamTag
;
use
phpDocumentor\Reflection\DocBlock\Tag\ReturnTag
;
use
phpDocumentor\Reflection\DocBlock\Tag\ReturnTag
;
/**
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
EventDoc
extends
ConstDoc
class
EventDoc
extends
ConstDoc
{
{
public
$type
;
public
$type
;
...
...
extensions/yii/apidoc/models/FunctionDoc.php
View file @
f7e00887
...
@@ -13,6 +13,11 @@ use phpDocumentor\Reflection\DocBlock\Tag\ReturnTag;
...
@@ -13,6 +13,11 @@ use phpDocumentor\Reflection\DocBlock\Tag\ReturnTag;
use
phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag
;
use
phpDocumentor\Reflection\DocBlock\Tag\ThrowsTag
;
use
yii\base\Exception
;
use
yii\base\Exception
;
/**
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
FunctionDoc
extends
BaseDoc
class
FunctionDoc
extends
BaseDoc
{
{
/**
/**
...
...
extensions/yii/apidoc/models/InterfaceDoc.php
View file @
f7e00887
...
@@ -7,6 +7,11 @@
...
@@ -7,6 +7,11 @@
namespace
yii\apidoc\models
;
namespace
yii\apidoc\models
;
/**
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
InterfaceDoc
extends
TypeDoc
class
InterfaceDoc
extends
TypeDoc
{
{
public
$parentInterfaces
=
[];
public
$parentInterfaces
=
[];
...
...
extensions/yii/apidoc/models/MethodDoc.php
View file @
f7e00887
...
@@ -7,6 +7,11 @@
...
@@ -7,6 +7,11 @@
namespace
yii\apidoc\models
;
namespace
yii\apidoc\models
;
/**
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
MethodDoc
extends
FunctionDoc
class
MethodDoc
extends
FunctionDoc
{
{
public
$isAbstract
;
public
$isAbstract
;
...
...
extensions/yii/apidoc/models/ParamDoc.php
View file @
f7e00887
...
@@ -9,6 +9,11 @@ namespace yii\apidoc\models;
...
@@ -9,6 +9,11 @@ namespace yii\apidoc\models;
use
yii\base\Object
;
use
yii\base\Object
;
/**
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
ParamDoc
extends
Object
class
ParamDoc
extends
Object
{
{
public
$name
;
public
$name
;
...
...
extensions/yii/apidoc/models/PropertyDoc.php
View file @
f7e00887
...
@@ -9,6 +9,11 @@ namespace yii\apidoc\models;
...
@@ -9,6 +9,11 @@ namespace yii\apidoc\models;
use
phpDocumentor\Reflection\DocBlock\Tag\VarTag
;
use
phpDocumentor\Reflection\DocBlock\Tag\VarTag
;
/**
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
PropertyDoc
extends
BaseDoc
class
PropertyDoc
extends
BaseDoc
{
{
public
$visibility
;
public
$visibility
;
...
...
extensions/yii/apidoc/models/TraitDoc.php
View file @
f7e00887
...
@@ -7,6 +7,11 @@
...
@@ -7,6 +7,11 @@
namespace
yii\apidoc\models
;
namespace
yii\apidoc\models
;
/**
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
TraitDoc
extends
TypeDoc
class
TraitDoc
extends
TypeDoc
{
{
// classes using the trait
// classes using the trait
...
...
extensions/yii/apidoc/models/TypeDoc.php
View file @
f7e00887
...
@@ -11,6 +11,11 @@ use phpDocumentor\Reflection\DocBlock\Tag\AuthorTag;
...
@@ -11,6 +11,11 @@ use phpDocumentor\Reflection\DocBlock\Tag\AuthorTag;
use
yii\base\Exception
;
use
yii\base\Exception
;
use
yii\helpers\StringHelper
;
use
yii\helpers\StringHelper
;
/**
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
TypeDoc
extends
BaseDoc
class
TypeDoc
extends
BaseDoc
{
{
public
$authors
=
[];
public
$authors
=
[];
...
...
extensions/yii/apidoc/
component
s/BaseRenderer.php
→
extensions/yii/apidoc/
template
s/BaseRenderer.php
View file @
f7e00887
...
@@ -5,33 +5,28 @@
...
@@ -5,33 +5,28 @@
* @license http://www.yiiframework.com/license/
* @license http://www.yiiframework.com/license/
*/
*/
namespace
yii\apidoc\
component
s
;
namespace
yii\apidoc\
template
s
;
use
Yii
;
use
Yii
;
use
yii\base\Component
;
use
yii\base\Component
;
use
yii\console\Controller
;
use
yii\console\Controller
;
use
yii\apidoc\models\Context
;
use
yii\apidoc\models\Context
;
use
yii\web\AssetManager
;
use
yii\web\View
;
use
yii\web\View
;
/**
* Base class for all API documentation renderers
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
abstract
class
BaseRenderer
extends
Component
abstract
class
BaseRenderer
extends
Component
{
{
private
$_view
;
public
function
getView
()
{
if
(
$this
->
_view
===
null
)
{
$this
->
_view
=
new
View
();
}
return
$this
->
_view
;
}
/**
/**
* @param Context $context
* Renders a given [[Context]].
* @param Controller $controller
*
* @return mixed
* @param Context $context the api documentation context to render.
* @param Controller $controller the apidoc controller instance. Can be used to control output.
*/
*/
public
abstract
function
render
(
$context
,
$controller
);
public
abstract
function
render
(
$context
,
$controller
);
}
}
\ No newline at end of file
\ No newline at end of file
extensions/yii/apidoc/templates/html/README.md
0 → 100644
View file @
f7e00887
The html API doc template
-------------------------
This templates provides view files and a Renderer class that can be reused in other html templates.
\ No newline at end of file
extensions/yii/apidoc/
components/Offline
Renderer.php
→
extensions/yii/apidoc/
templates/html/
Renderer.php
View file @
f7e00887
...
@@ -5,8 +5,7 @@
...
@@ -5,8 +5,7 @@
* @license http://www.yiiframework.com/license/
* @license http://www.yiiframework.com/license/
*/
*/
namespace
yii\apidoc\components
;
namespace
yii\apidoc\templates\html
;
use
yii\apidoc\models\BaseDoc
;
use
yii\apidoc\models\BaseDoc
;
use
yii\apidoc\models\ConstDoc
;
use
yii\apidoc\models\ConstDoc
;
...
@@ -14,35 +13,80 @@ use yii\apidoc\models\EventDoc;
...
@@ -14,35 +13,80 @@ use yii\apidoc\models\EventDoc;
use
yii\apidoc\models\MethodDoc
;
use
yii\apidoc\models\MethodDoc
;
use
yii\apidoc\models\PropertyDoc
;
use
yii\apidoc\models\PropertyDoc
;
use
yii\apidoc\models\TypeDoc
;
use
yii\apidoc\models\TypeDoc
;
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\Context
;
use
yii\apidoc\models\InterfaceDoc
;
use
yii\apidoc\models\TraitDoc
;
use
yii\apidoc\templates\BaseRenderer
;
use
yii\base\ViewContextInterface
;
use
yii\base\ViewContextInterface
;
use
yii\console\Controller
;
use
yii\console\Controller
;
use
yii\helpers\Console
;
use
yii\helpers\Console
;
use
yii\helpers\FileHelper
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\apidoc\models\ClassDoc
;
use
yii\apidoc\models\Context
;
use
Yii
;
use
Yii
;
use
yii\
apidoc\models\InterfaceDoc
;
use
yii\
web\AssetManager
;
use
yii\
apidoc\models\TraitDoc
;
use
yii\
web\View
;
class
OfflineRenderer
extends
BaseRenderer
implements
ViewContextInterface
/**
* The base class for HTML API documentation renderers.
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
abstract
class
Renderer
extends
BaseRenderer
implements
ViewContextInterface
{
{
/**
* @var string directory to use for output of html files. Can be a path alias.
*/
public
$targetDir
;
public
$targetDir
;
/**
public
$layout
=
'@yii/apidoc/views/layouts/offline.php'
;
* @var string string to use as the title of the generated page.
public
$typeView
=
'@yii/apidoc/views/type.php'
;
*/
public
$indexView
=
'@yii/apidoc/views/index.php'
;
public
$pageTitle
=
'Yii Framework 2.0 API Documentation'
;
public
$pageTitle
=
'Yii Framework 2.0 API Documentation'
;
/**
/**
* @var Context
* @var string path or alias of the layout file to use.
*/
public
$layout
;
/**
* @var string path or alias of the view file to use for rendering types (classes, interfaces, traits).
*/
public
$typeView
=
'@yii/apidoc/templates/html/views/type.php'
;
/**
* @var string path or alias of the view file to use for rendering the index page.
*/
public
$indexView
=
'@yii/apidoc/templates/html/views/index.php'
;
/**
* @var Context the [[Context]] currently being rendered.
*/
*/
protected
$context
;
protected
$context
;
/**
* @var View
*/
private
$_view
;
/**
* @return View the view instance
*/
public
function
getView
()
{
if
(
$this
->
_view
===
null
)
{
$this
->
_view
=
new
View
();
$assetPath
=
Yii
::
getAlias
(
$this
->
targetDir
)
.
'/assets'
;
if
(
!
is_dir
(
$assetPath
))
{
mkdir
(
$assetPath
);
}
$this
->
_view
->
assetManager
=
new
AssetManager
([
'basePath'
=>
$assetPath
,
'baseUrl'
=>
'/assets'
,
]);
}
return
$this
->
_view
;
}
/**
/**
* @param Context $context
* Renders a given [[Context]].
* @param Controller $controller
*
* @param Context $context the api documentation context to render.
* @param Controller $controller the apidoc controller instance. Can be used to control output.
*/
*/
public
function
render
(
$context
,
$controller
)
public
function
render
(
$context
,
$controller
)
{
{
...
@@ -72,11 +116,6 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
...
@@ -72,11 +116,6 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
Console
::
updateProgress
(
++
$done
,
$typeCount
);
Console
::
updateProgress
(
++
$done
,
$typeCount
);
Console
::
endProgress
(
true
);
Console
::
endProgress
(
true
);
$controller
->
stdout
(
'done.'
.
PHP_EOL
,
Console
::
FG_GREEN
);
$controller
->
stdout
(
'done.'
.
PHP_EOL
,
Console
::
FG_GREEN
);
$controller
->
stdout
(
'Copying asset files... '
);
FileHelper
::
copyDirectory
(
__DIR__
.
'/../assets/css'
,
$dir
.
'/css'
);
$controller
->
stdout
(
'done.'
.
PHP_EOL
,
Console
::
FG_GREEN
);
}
}
protected
function
renderWithLayout
(
$viewFile
,
$params
)
protected
function
renderWithLayout
(
$viewFile
,
$params
)
...
@@ -93,7 +132,7 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
...
@@ -93,7 +132,7 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
/**
/**
* creates a link to a type (class, interface or trait)
* creates a link to a type (class, interface or trait)
* @param ClassDoc|InterfaceDoc|TraitDoc $types
* @param ClassDoc|InterfaceDoc|TraitDoc $types
* @param
string $title
* @param
BaseDoc $context
* @return string
* @return string
*/
*/
public
function
typeLink
(
$types
,
$context
=
null
)
public
function
typeLink
(
$types
,
$context
=
null
)
...
@@ -161,6 +200,7 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
...
@@ -161,6 +200,7 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
*/
*/
private
function
resolveNamespace
(
$context
)
private
function
resolveNamespace
(
$context
)
{
{
// TODO use phpdoc Context for this
if
(
$context
===
null
)
{
if
(
$context
===
null
)
{
return
''
;
return
''
;
}
}
...
@@ -285,8 +325,6 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
...
@@ -285,8 +325,6 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
.
(
$param
->
isOptional
?
' = '
.
$param
->
defaultValue
:
''
);
.
(
$param
->
isOptional
?
' = '
.
$param
->
defaultValue
:
''
);
}
}
//<?php echo preg_replace('/\{\{([^\{\}]*?)\|([^\{\}]*?)\}\}\(/','$2(',$method->signature);
return
(
$method
->
isReturnByReference
?
'<b>&</b>'
:
''
)
return
(
$method
->
isReturnByReference
?
'<b>&</b>'
:
''
)
.
(
$method
->
returnType
===
null
?
'void'
:
$this
->
typeLink
(
$method
->
returnTypes
))
.
(
$method
->
returnType
===
null
?
'void'
:
$this
->
typeLink
(
$method
->
returnTypes
))
.
' '
.
$method
->
name
.
'( '
.
' '
.
$method
->
name
.
'( '
...
@@ -294,7 +332,7 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
...
@@ -294,7 +332,7 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
.
' )'
;
.
' )'
;
}
}
p
ublic
function
generateFileName
(
$typeName
)
p
rotected
function
generateFileName
(
$typeName
)
{
{
return
strtolower
(
str_replace
(
'\\'
,
'_'
,
$typeName
))
.
'.html'
;
return
strtolower
(
str_replace
(
'\\'
,
'_'
,
$typeName
))
.
'.html'
;
}
}
...
@@ -306,6 +344,6 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
...
@@ -306,6 +344,6 @@ class OfflineRenderer extends BaseRenderer implements ViewContextInterface
*/
*/
public
function
findViewFile
(
$view
)
public
function
findViewFile
(
$view
)
{
{
return
Yii
::
getAlias
(
'@yii/apidoc/views/'
.
$view
);
return
Yii
::
getAlias
(
'@yii/apidoc/
templates/html/
views/'
.
$view
);
}
}
}
}
\ No newline at end of file
extensions/yii/apidoc/views/constSummary.php
→
extensions/yii/apidoc/
templates/html/
views/constSummary.php
View file @
f7e00887
File moved
extensions/yii/apidoc/views/eventDetails.php
→
extensions/yii/apidoc/
templates/html/
views/eventDetails.php
View file @
f7e00887
File moved
extensions/yii/apidoc/views/eventSummary.php
→
extensions/yii/apidoc/
templates/html/
views/eventSummary.php
View file @
f7e00887
File moved
extensions/yii/apidoc/views/methodDetails.php
→
extensions/yii/apidoc/
templates/html/
views/methodDetails.php
View file @
f7e00887
File moved
extensions/yii/apidoc/views/methodSummary.php
→
extensions/yii/apidoc/
templates/html/
views/methodSummary.php
View file @
f7e00887
File moved
extensions/yii/apidoc/views/propertyDetails.php
→
extensions/yii/apidoc/
templates/html/
views/propertyDetails.php
View file @
f7e00887
File moved
extensions/yii/apidoc/views/propertySummary.php
→
extensions/yii/apidoc/
templates/html/
views/propertySummary.php
View file @
f7e00887
File moved
extensions/yii/apidoc/views/seeAlso.php
→
extensions/yii/apidoc/
templates/html/
views/seeAlso.php
View file @
f7e00887
File moved
extensions/yii/apidoc/views/type.php
→
extensions/yii/apidoc/
templates/html/
views/type.php
View file @
f7e00887
...
@@ -81,21 +81,21 @@ $renderer = $this->context;
...
@@ -81,21 +81,21 @@ $renderer = $this->context;
</div>
</div>
<a
name=
"properties"
></a>
<a
name=
"properties"
></a>
<?=
$this
->
render
(
'propertySummary'
,
[
'type'
=>
$type
,
'protected'
=>
false
])
?>
<?=
$this
->
render
(
'
@yii/apidoc/templates/html/views/
propertySummary'
,
[
'type'
=>
$type
,
'protected'
=>
false
])
?>
<?=
$this
->
render
(
'propertySummary'
,
[
'type'
=>
$type
,
'protected'
=>
true
])
?>
<?=
$this
->
render
(
'
@yii/apidoc/templates/html/views/
propertySummary'
,
[
'type'
=>
$type
,
'protected'
=>
true
])
?>
<a
name=
"methods"
></a>
<a
name=
"methods"
></a>
<?=
$this
->
render
(
'methodSummary'
,
[
'type'
=>
$type
,
'protected'
=>
false
])
?>
<?=
$this
->
render
(
'
@yii/apidoc/templates/html/views/
methodSummary'
,
[
'type'
=>
$type
,
'protected'
=>
false
])
?>
<?=
$this
->
render
(
'methodSummary'
,
[
'type'
=>
$type
,
'protected'
=>
true
])
?>
<?=
$this
->
render
(
'
@yii/apidoc/templates/html/views/
methodSummary'
,
[
'type'
=>
$type
,
'protected'
=>
true
])
?>
<a
name=
"events"
></a>
<a
name=
"events"
></a>
<?=
$this
->
render
(
'eventSummary'
,
[
'type'
=>
$type
])
?>
<?=
$this
->
render
(
'
@yii/apidoc/templates/html/views/
eventSummary'
,
[
'type'
=>
$type
])
?>
<a
name=
"constants"
></a>
<a
name=
"constants"
></a>
<?=
$this
->
render
(
'constSummary'
,
[
'type'
=>
$type
])
?>
<?=
$this
->
render
(
'
@yii/apidoc/templates/html/views/
constSummary'
,
[
'type'
=>
$type
])
?>
<?=
$this
->
render
(
'propertyDetails'
,
[
'type'
=>
$type
])
?>
<?=
$this
->
render
(
'
@yii/apidoc/templates/html/views/
propertyDetails'
,
[
'type'
=>
$type
])
?>
<?=
$this
->
render
(
'methodDetails'
,
[
'type'
=>
$type
])
?>
<?=
$this
->
render
(
'
@yii/apidoc/templates/html/views/
methodDetails'
,
[
'type'
=>
$type
])
?>
<?php
if
(
$type
instanceof
ClassDoc
)
:
?>
<?php
if
(
$type
instanceof
ClassDoc
)
:
?>
<?=
$this
->
render
(
'eventDetails'
,
[
'type'
=>
$type
])
?>
<?=
$this
->
render
(
'
@yii/apidoc/templates/html/views/
eventDetails'
,
[
'type'
=>
$type
])
?>
<?php
endif
;
?>
<?php
endif
;
?>
extensions/yii/apidoc/templates/offline/Renderer.php
0 → 100644
View file @
f7e00887
<?php
/**
* @link http://www.yiiframework.com/
* @copyright Copyright (c) 2008 Yii Software LLC
* @license http://www.yiiframework.com/license/
*/
namespace
yii\apidoc\templates\offline
;
use
yii\apidoc\models\Context
;
use
yii\console\Controller
;
use
Yii
;
use
yii\helpers\Console
;
use
yii\helpers\FileHelper
;
/**
*
* @author Carsten Brandt <mail@cebe.cc>
* @since 2.0
*/
class
Renderer
extends
\yii\apidoc\templates\html\Renderer
{
public
$layout
=
'@yii/apidoc/templates/offline/views/offline.php'
;
public
$indexView
=
'@yii/apidoc/templates/offline/views/index.php'
;
public
$pageTitle
=
'Yii Framework 2.0 API Documentation'
;
/**
* Renders a given [[Context]].
*
* @param Context $context the api documentation context to render.
* @param Controller $controller the apidoc controller instance. Can be used to control output.
*/
public
function
render
(
$context
,
$controller
)
{
parent
::
render
(
$context
,
$controller
);
$dir
=
Yii
::
getAlias
(
$this
->
targetDir
);
$controller
->
stdout
(
'Copying asset files... '
);
FileHelper
::
copyDirectory
(
__DIR__
.
'/assets/css'
,
$dir
.
'/css'
);
$controller
->
stdout
(
'done.'
.
PHP_EOL
,
Console
::
FG_GREEN
);
}
}
\ No newline at end of file
extensions/yii/apidoc/assets/css/api.css
→
extensions/yii/apidoc/
templates/offline/
assets/css/api.css
View file @
f7e00887
File moved
extensions/yii/apidoc/assets/css/style.css
→
extensions/yii/apidoc/
templates/offline/
assets/css/style.css
View file @
f7e00887
File moved
extensions/yii/apidoc/views/index.php
→
extensions/yii/apidoc/
templates/offline/
views/index.php
View file @
f7e00887
File moved
extensions/yii/apidoc/
views/layout
s/offline.php
→
extensions/yii/apidoc/
templates/offline/view
s/offline.php
View file @
f7e00887
...
@@ -35,6 +35,7 @@ $this->beginPage();
...
@@ -35,6 +35,7 @@ $this->beginPage();
All Rights Reserved.
<br/>
All Rights Reserved.
<br/>
</div>
<!-- end of footer -->
</div>
<!-- end of footer -->
<?php
\yii\web\JqueryAsset
::
register
(
$this
);
?>
<script
type=
"text/javascript"
>
<script
type=
"text/javascript"
>
/*<![CDATA[*/
/*<![CDATA[*/
$
(
"a.toggle"
).
toggle
(
function
(){
$
(
"a.toggle"
).
toggle
(
function
(){
...
...
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