Page Menu
Home
In-Portal Phabricator
Search
Configure Global Search
Log In
Files
F1050478
AbstractCommand.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
Wed, Jul 2, 2:47 PM
Size
2 KB
Mime Type
text/x-php
Expires
Fri, Jul 4, 2:47 PM (15 h, 27 m)
Engine
blob
Format
Raw Data
Handle
678722
Attached To
rINP In-Portal
AbstractCommand.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
Symfony\Component\Console\Command\Command
as
SymfonyCommand
;
use
Symfony\Component\Console\Input\InputInterface
;
use
Symfony\Component\Console\Output\OutputInterface
;
defined
(
'FULL_PATH'
)
or
die
(
'restricted access!'
);
abstract
class
AbstractCommand
extends
SymfonyCommand
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
();
}
}
/**
* Perform additional validation of the input.
*
* @param InputInterface $input An InputInterface instance.
* @param OutputInterface $output An OutputInterface instance.
*
* @return void
* @throws \RuntimeException When not all required arguments were passed.
*/
protected
function
initialize
(
InputInterface
$input
,
OutputInterface
$output
)
{
$arguments
=
array_filter
(
$input
->
getArguments
());
// Consider required arguments passed with empty values as an error.
if
(
count
(
$arguments
)
<
$this
->
getDefinition
()->
getArgumentRequiredCount
()
)
{
throw
new
\RuntimeException
(
'Not enough arguments.'
);
}
}
}
Event Timeline
Log In to Comment