Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1050706
CompletionCommand.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Thu, Jul 3, 8:34 AM
Size
2 KB
Mime Type
text/x-php
Expires
Sat, Jul 5, 8:34 AM (1 d, 3 h)
Engine
blob
Format
Raw Data
Handle
678907
Attached To
rINP In-Portal
CompletionCommand.php
View Options
<?php
/**
* @version $Id$
* @package In-Portal
* @copyright Copyright (C) 1997 - 2015 Intechnic. All rights reserved.
* @license GNU/GPL
* In-Portal is Open Source software.
* This means that this software may have been modified pursuant
* the GNU General Public License, and as distributed it includes
* or is derivative of works licensed under the GNU General Public License
* or other free or open source software licenses.
* See http://www.in-portal.org/license for copyright notices and details.
*/
namespace
Intechnic\InPortal\Core\kernel\Console\Command
;
use
Intechnic\InPortal\Core\kernel\Console\ConsoleApplication
;
use
Stecman\Component\Symfony\Console\BashCompletion\Completion
;
use
Stecman\Component\Symfony\Console\BashCompletion\CompletionCommand
as
BashCompletionCommand
;
use
Stecman\Component\Symfony\Console\BashCompletion\CompletionHandler
;
defined
(
'FULL_PATH'
)
or
die
(
'restricted access!'
);
class
CompletionCommand
extends
BashCompletionCommand
implements
IConsoleCommand
{
/**
* Reference to global kApplication instance
*
* @var \kApplication.
*/
protected
$Application
=
null
;
/**
* Connection to database.
*
* @var \IDBConnection
*/
protected
$Conn
=
null
;
/**
* Sets the application instance for this command.
*
* @param ConsoleApplication $application An Application instance.
*
* @return void
*/
public
function
setApplication
(
ConsoleApplication
$application
=
null
)
{
parent
::
setApplication
(
$application
);
// For disabled commands $application is not set.
if
(
isset
(
$application
)
)
{
$this
->
Application
=
$application
->
getKernelApplication
();
$this
->
Conn
=&
$this
->
Application
->
GetADODBConnection
();
}
}
/**
* Configure the CompletionHandler instance before it is run
*
* @param CompletionHandler $handler Completion handler.
*
* @return void
*/
protected
function
configureCompletion
(
CompletionHandler
$handler
)
{
// This can be removed once https://github.com/stecman/symfony-console-completion v0.5.2 will be released.
$handler
->
addHandler
(
new
Completion
(
'help'
,
'command_name'
,
Completion
::
TYPE_ARGUMENT
,
array_keys
(
$this
->
getApplication
()->
all
())
)
);
$handler
->
addHandler
(
new
Completion
(
'list'
,
'namespace'
,
Completion
::
TYPE_ARGUMENT
,
$this
->
getApplication
()->
getNamespaces
()
)
);
}
}
Event Timeline
Log In to Comment