Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 8
BaseCommand
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 2
6
0.00% covered (danger)
0.00%
0 / 8
 __construct
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 3
 render
0.00% covered (danger)
0.00%
0 / 1
2
0.00% covered (danger)
0.00%
0 / 5
<?php
/**
 * @file
 * Contains \Drupal\Core\Ajax\BaseCommand.
 */
namespace Drupal\Core\Ajax;
/**
 * Base command that only exists to simplify AJAX commands.
 */
class BaseCommand implements CommandInterface {
  /**
   * The name of the command.
   *
   * @var string
   */
  protected $command;
  /**
   * The data to pass on to the client side.
   *
   * @var string
   */
  protected $data;
  /**
   * Constructs a BaseCommand object.
   *
   * @param string $command
   *   The name of the command.
   * @param string $data
   *   The data to pass on to the client side.
   */
  public function __construct($command, $data) {
    $this->command = $command;
    $this->data = $data;
  }
  /**
   * {@inheritdoc}
   */
  public function render() {
    return array(
      'command' => $this->command,
      'data' => $this->data,
    );
  }
}