Get mappings for the resource.

@param  mixed  $command
@return string
557505
public static function getMappings($resource, $key = 'default')
	{
		$resourceName = $resource;

		if( is_object($resource) )
		{
			$resourceName = get_class($resource);
		}

		$mappings = [];
		if( isset(self::$mappers[$key]) )
		{
			$mappings = array_merge_recursive( $mappings, call_user_func(self::$mappers[$key], $resourceName) );
		}

		if( isset(self::$mappings[$key]) && isset(self::$mappings[$key][$resourceName]) )
		{
			$mappings = array_merge_recursive( $mappings, (array) self::$mappings[$key][$resourceName] );
		}

		return $mappings;
	}
324157
protected function aliasesFor(Command $command): array
    {
        $aliases = [$name = $command->name()];

        foreach ($this->aliases as $alias => $command) {
            if (\in_array($name, [$alias, $command])) {
                $aliases[] = $alias;
                $aliases[] = $command;
            }
        }

        return $aliases;
    }
800868
public function get($command)
    {
        $commands = $this->getHandlers();
        return empty($commands[$command]) ? array() : $commands[$command];
    }
684671
public function processCommand($command)
    {
        // Add environment flag to commands
        $stage = $this->connections->getCurrentConnectionKey()->stage;
        if (Str::contains($command, 'artisan') && $stage) {
            $command .= ' --env="'.$stage.'"';
        }

        return $command;
    }
1093199
protected function getKeyFromInterleavedArguments(string $command, array $arguments)
    {
        $keys = [];

        for ($i = 0, $n = \count($arguments); $i < $n; $i += 2) {
            $keys[] = $arguments[$i];
        }

        if ($this->checkSameSlotForKeys($keys)) {
            return $arguments[0];
        }

        return null;
    }
32770
protected function _getServerHttpUrlFromCommand($command)
    {
        $base = null;

        $cmMethod = strtolower( (string) $command );
        switch ($cmMethod) {
            case 'getauthurl':
                $base = 'auth';
                break;
            case 'token':
                $base = 'auth/token';
                break;

            case 'register':
                $base = 'api/v1/members';
                break;

            case 'accountinfo':
                $params = iterator_to_array($command);
                if (isset($params['username']))
                    $postfix = 'u/'.$params['username'];
                else
                    $postfix = '-'.current($params);
                $base = 'api/v1/members/profile/'.$postfix;
                break;

            case 'listaccountsinfo':
                $base = 'api/v1/members/profiles';
                break;

            case 'recover::validate':
                /** @var Validate $command */
                $params = iterator_to_array($command);
                $base = 'api/v1/me/identifiers/change/confirm/'.$params['validation_code'];
                break;
            case 'recover::resendcode':
                /** @var Validate $command */
                $params = iterator_to_array($command);
                $base = 'recover/validate/resend/'.$params['validation_code'].'/'.$params['identifier_type'];
                break;

            case 'members::exists':
                /** @var Exists $command */
                $base = 'api/v1/members/exists';
                break;
            case 'members::whois':
                /** @var Whois $command */
                $base = 'api/v1/members/whois';
                break;
            case 'members::validateuseridentifier':
                /** @var ValidateUserIdentifier $command */
                $base = 'api/v1/members/'.$command->getUserId().'/validate/'.$command->getIdentifier();
                break;

            case 'me::accountinfo':
                $postfix = '';
                /** @var AccountInfo $command */
                if ( $command->getIncludeGrants() )
                    $postfix = '?grants';

                $base = 'api/v1/me/profile'.$postfix;
                break;
            case 'me::changepassword':
                $base = 'api/v1/me/grants/password';
                break;
            case 'me::changeidentity':
                $base = 'api/v1/me/identifiers/change';
                break;
        }

        $serverUrl = rtrim($this->serverBaseUrl, '/');
        (! $base ) ?: $serverUrl .= '/'. trim($base, '/');
        return $serverUrl;
    }
852481
public static function getCommand($command)
    {
        if (!is_string($command) || strlen($command) < 1) {
            throw new BadMethodCallException('Parameter command is not a valid string');
        }
        $instance = self::getInstance();
        
        if (!isset($instance->commands[$command])) {
            throw new BadMethodCallException('Command "' . $command . '" is not a registered command');
        }
        
        return $instance->commands[$command];
    }
562498
public function resolve($command)
    {
        $commandInstance = $this->di->get($command);

        return $this->add($commandInstance);
    }
1199597
public function generate($command){
    $perl_cmd = str_replace('_', '-', $command);
    if ( isset($this->commands[$perl_cmd]) ){
      $cmd = $this->commands[$perl_cmd];
      $st = '$vm->'.$command.'(['.PHP_EOL;
      foreach ( $cmd['args'] as $k => $v ){
        $st .= "'$k' => ".($v['binary'] ? '0' : "''").PHP_EOL;
      }
      $st .= ']);';
      return $st;
    }
    return false;
  }
225009
protected function generateCommandUrl(string $command, array $parameters = [])
    {
        $query = '';
        if (!empty($parameters)) {
            $query = '?' . http_build_query($parameters);
        }

        return $this->ssoServerUrl . '/sso/' . $command . $query;
    }
1326695
protected function getUrl(Command $command)
    {
        return $this->url
            .(stripos($this->url, '?') !== false ? '&' : '?')
            .http_build_query([self::COMMAND => $command->getName()]);
    }
41354
protected function getKeyFromSortCommand(CommandInterface $command)
    {
        $arguments = $command->getArguments();
        $firstKey = $arguments[0];

        if (1 === $argc = count($arguments)) {
            return $firstKey;
        }

        $keys = array($firstKey);

        for ($i = 1; $i < $argc; ++$i) {
            if (strtoupper($arguments[$i]) === 'STORE') {
                $keys[] = $arguments[++$i];
            }
        }

        if ($this->checkSameSlotForKeys($keys)) {
            return $firstKey;
        }
    }
914343
public function profileCommand($command) {
		$tasks = $this->Task->find('all', array(
			'conditions' => array(
				'command' => $command,
				'status' => array(TaskType::STOPPED, TaskType::FINISHED),
				'runtime >' => 0
			),
			'fields' => array('runtime', 'id', 'started', 'stopped', 'created', 'waittime'),
			'limit' => Configure::read('Task.profilerLimit'),
			'order' => array(
				'id' => 'DESC'
			)
		));

		if (!$tasks) {
			return null;
		}

		$statistics = array_map(function($item) {
			$endDate = new DateTime($item['stopped']);
			$startDate = new DateTime($item['started']);
			$createdDate = new DateTime($item['created']);
			$item['runtimeHuman'] = $startDate->diff($endDate)->format(Configure::read('Task.dateDiffFormat'));
			$item['waittimeHuman'] = $createdDate->diff($startDate)->format(Configure::read('Task.dateDiffFormat'));
			$item['startedTimestamp'] = $startDate->getTimestamp();
			$item['runtime'] = (int)$item['runtime'];
			$item['waittime'] = (int)$item['waittime'];
			return $item;
		}, Hash::extract($tasks, '{n}.{s}'));
		
		$runtimes = Hash::extract($statistics, '{n}.runtime');
		$runtimeAverage = (int)round($runtimes ? array_sum($runtimes) / count($runtimes) : 0);
		$runtimeMax = $runtimes ? max($runtimes) : 0;
		$runtimeMin = $runtimes ? min($runtimes) : 0;

		$waittimes = Hash::extract($statistics, '{n}.waittime');
		$waittimeAverage = (int)round($waittimes ? array_sum($waittimes) / count($waittimes) : 0);
		$waittimeMax = $waittimes ? max($waittimes) : 0;
		$waittimeMin = $waittimes ? min($waittimes) : 0;

		$countByStatus = array();
		foreach (TaskType::getTypes() as $statusCode) {
			$countByStatus[$statusCode] = $this->Task->find('count', array(
				'conditions' => array(
					'command' => $command,
					'status' => $statusCode
				)
			));
		}

		$errored = $this->Task->find('count', array(
			'conditions' => array(
				'command' => $command,
				'errored' => true
			)
		));

		return array(
			'command' => $command,
			'countByStatus' => $countByStatus,
			'errored' => $errored,
			'statistics' => $statistics,
			'runtimeAverage' => $runtimeAverage,
			'runtimeAverageHuman' => $this->_secondsToHuman($runtimeAverage),
			'runtimeMax' => $runtimeMax,
			'runtimeMaxHuman' => $this->_secondsToHuman($runtimeMax),
			'runtimeMin' => $runtimeMin,
			'runtimeMinHuman' => $this->_secondsToHuman($runtimeMin),
			'waittimeAverage' => $waittimeAverage,
			'waittimeAverageHuman' => $this->_secondsToHuman($waittimeAverage),
			'waittimeMax' => $waittimeMax,
			'waittimeMaxHuman' => $this->_secondsToHuman($waittimeMax),
			'waittimeMin' => $waittimeMin,
			'waittimeMinHuman' => $this->_secondsToHuman($waittimeMin),
		);
	}
1032491
protected function sendToAllConnections($command)
    {
        $this->connect();

        $args = array();
        if (func_num_args() > 1) {
            $args = func_get_args();
            array_shift($args);
        }

        $ret = array();
        foreach ($this->connections as $conn) {
            $ret[] = call_user_func_array(array($conn, $command), $args);
        }

        return $ret;
    }
403130
public function getMapping($name) {
        if (isset($this->mappings['names'][$name]))
            return $this->mappings['names'][$name];
        return null;
    }
620945
public function getCallbacks($command)
    {
        $result = array();
        $command = strtolower($command);

        if (isset($this->_callbacks[$command])) {
            $result = $this->_callbacks[$command];
        }

        return $result;
    }
748705
private function instantiateParameters(Command $command) {
        return array_map(function(\ReflectionParameter $param) {
            return $this->container->get($param->getType()->getName());
        }, (new ReflectionClass(get_class($command)))->getMethod('execute')->getParameters());
    }