DayleRees\ContainerDebug\Command::formatServiceDescription PHP Метод

formatServiceDescription() публичный Метод

Retrieve a suitable formatted service description.
public formatServiceDescription ( mixed $service, boolean $scalar = true ) : string
$service mixed
$scalar boolean
Результат string
    public function formatServiceDescription($service, $scalar = true)
    {
        return sprintf($scalar ? self::SCALAR_FORMAT : self::NON_SCALAR_FORMAT, gettype($service), $scalar ? (string) $service : null);
    }

Usage Example

Пример #1
0
 public function testServiceDescriptionCanBeFormatted()
 {
     $command = new Command();
     $description = $command->formatServiceDescription('foo', false);
     $this->assertEquals('<string>', $description);
     $description = $command->formatServiceDescription('foo', true);
     $this->assertEquals('<string> "foo"', $description);
 }