protected function execute(InputInterface $input, OutputInterface $output)
 {
     $in = $input->getArgument('in');
     if (!is_readable($in)) {
         throw new \InvalidArgumentException("in must be a readable file or directory");
     }
     $this->setupDriver($input->getOption("builtinannot"));
     $config = $this->generateConfigs($in);
     $json = $this->mapper->writeString($config, '\\Weasel\\JsonMarshaller\\Config\\ClassMarshaller[string]');
     if ($out = $input->getArgument("out")) {
         file_put_contents($out, $json);
     } else {
         print $json;
     }
 }
Ejemplo n.º 2
0
 /**
  * @covers \Weasel\JsonMarshaller\JsonMapper
  * @expectedException \Weasel\JsonMarshaller\Exception\BadConfigurationException
  * @expectedExceptionMessage is not an instantiable class
  */
 public function testBadSubtypeOfInterface()
 {
     $configProvider = new MockedConfigProvider();
     $mti = 'Weasel\\JsonMarshaller\\MockTestInterface';
     $config = new Config\ClassMarshaller();
     $configProvider->fakeConfig[$mti] = $config;
     $mapper = new JsonMapper($configProvider);
     $mapper->readString(json_encode(array("blah" => "foo")), $mti);
 }