/** * Namespace test */ public function testNamespace() { $naming = new Naming(); $this->assertArraySubset(['block' => 'block', 'elem' => 'elem'], $naming->parse('block__elem')); $naming = new Naming(['elem' => '==']); $this->assertArraySubset(['block' => 'block', 'elem' => 'elem'], $naming->parse('block==elem')); }
/** * @inheritdoc */ protected function execute(InputInterface $input, OutputInterface $output) { $naming = new Naming(); $result = []; foreach (explode(' ', $input->getArgument('text')) as $str) { $data = $naming->parse($str); if ($data === null) { continue; } $result[] = ['str' => $str] + $data; } if ($result === []) { throw new \Exception('cant\\t parse'); } $table = new Table($output); $keys = ['str' => null, 'block' => null, 'elem' => null, 'modName' => null, 'modVal' => null]; $table->setHeaders(array_keys($keys)); foreach ($result as $key => $r) { $table->setRow($key, array_merge($keys, $r)); } $table->render(); }