Overview

Namespaces

  • Webmozart
    • Console
      • Adapter
      • Api
        • Application
        • Args
          • Format
        • Command
        • Config
        • Event
        • Formatter
        • IO
        • Resolver
      • Args
      • Config
      • Formatter
      • Handler
        • Help
      • IO
        • InputStream
        • OutputStream
      • Process
      • Resolver
      • UI
        • Alignment
        • Component
        • Help
        • Layout
        • Style
      • Util

Classes

  • ConfigEvent
  • ConsoleEvents
  • PreHandleEvent
  • PreResolveEvent
  • Overview
  • Namespace
  • Class

Class PreHandleEvent

Dispatched before a command is handled.

Add a listener for this event to execute custom logic before or instead of the default handler.

Symfony\Component\EventDispatcher\Event
Extended by Webmozart\Console\Api\Event\PreHandleEvent
Namespace: Webmozart\Console\Api\Event
Author: Bernhard Schussek bschussek@gmail.com
Since: 1.0
Located at Api/Event/PreHandleEvent.php
Methods summary
public
# __construct( Webmozart\Console\Api\Args\Args $args, Webmozart\Console\Api\IO\IO $io, Webmozart\Console\Api\Command\Command $command )

Creates the event.

Creates the event.

Parameters

$args
The parsed console arguments.
$io
The I/O.
$command
The executed command.
public Webmozart\Console\Api\Args\Args
# getArgs( )

Returns the parsed console arguments.

Returns the parsed console arguments.

Returns

Webmozart\Console\Api\Args\Args
The parsed console arguments.
public Webmozart\Console\Api\IO\IO
# getIO( )

Returns the I/O.

Returns the I/O.

Returns

Webmozart\Console\Api\IO\IO
The I/O.
public Webmozart\Console\Api\Command\Command
# getCommand( )

Returns the executed command.

Returns the executed command.

Returns

Webmozart\Console\Api\Command\Command
The executed command.
public boolean
# isHandled( )

Returns whether the command was handled by the event listener.

Returns whether the command was handled by the event listener.

Returns

boolean

Returns true if the command was handled and false otherwise.

See

Webmozart\Console\Api\Event\PreHandleEvent::setHandled()
public
# setHandled( boolean $handled )

Sets whether the command was handled by the event listener.

Sets whether the command was handled by the event listener.

If set to true, the handler configured for the command is not executed. Instead the status code returned by Webmozart\Console\Api\Event\PreHandleEvent::getStatusCode() is returned.

Parameters

$handled

Whether the command was handled by the event listener.

public integer
# getStatusCode( )

Returns the status code to return.

Returns the status code to return.

Returns

integer
Returns 0 on success and any positive integer on error.
public
# setStatusCode( integer $statusCode )

Sets the status code to return.

Sets the status code to return.

This method is only useful in combination with Webmozart\Console\Api\Event\PreHandleEvent::setHandled(). If the event is not marked as handled, the status code is ignored.

Parameters

$statusCode

Set to 0 on success and any positive integer on error.

Webmozart Console API API documentation generated by ApiGen