/** * @test */ public function pushAndGetFromStackWorks() { $rootNode = new RootNode(); $this->parsingState->pushNodeToStack($rootNode); $this->assertSame($rootNode, $this->parsingState->getNodeFromStack($rootNode), 'Node returned from stack was not the right one.'); $this->assertSame($rootNode, $this->parsingState->popNodeFromStack($rootNode), 'Node popped from stack was not the right one.'); }
/** * Handler for array syntax. This creates the array object recursively and * adds it to the current node. * * @param ParsingState $state The current parsing state * @param string $arrayText The array as string. * @return void */ protected function arrayHandler(ParsingState $state, $arrayText) { $arrayNode = new ArrayNode($arrayText); $state->getNodeFromStack()->addChildNode($arrayNode); }