public function cleanGetterSetter() { $methodList = $this->analyzer->listRequiredMethod(); $fileContent = file_get_contents($this->analyzer->getReflection()->getFileName()); foreach ($methodList as $method) { $methodBuilder = $this->getBuilder($method); $fileContent = str_replace($methodBuilder->getMethodName(), '', $fileContent); } file_put_contents($this->analyzer->getReflection()->getFileName(), $fileContent); }
public function cleanGetterSetter() { $methodList = $this->analyzer->listRequiredMethod(); $fileContent = file_get_contents($this->analyzer->getReflection()->getFileName()); foreach ($methodList as $data) { switch ($data['type']) { case EntityAnalyzer::GETTER: $methodName = 'get' . Utils::capitalize($data['column']); $fileContent = str_replace($this->getMethodSrc($methodName), '', $fileContent); break; case EntityAnalyzer::SETTER: $methodName = 'set' . Utils::capitalize($data['column']); $fileContent = str_replace($this->getMethodSrc($methodName), '', $fileContent); break; case EntityAnalyzer::ADDER: $methodName = 'add' . Utils::capitalize($data['column']); $fileContent = str_replace($this->getMethodSrc($methodName), '', $fileContent); break; case EntityAnalyzer::REMOVER: $methodName = 'remove' . Utils::capitalize($data['column']); $fileContent = str_replace($this->getMethodSrc($methodName), '', $fileContent); break; } } file_put_contents($this->analyzer->getReflection()->getFileName(), $fileContent); }
public function testListRequiredMethod() { $this->assertEquals($this->entityAnalyzer->listRequiredMethod(), array('getUid' => array('type' => EntityAnalyzer::GETTER, 'column' => 'uid'), 'setUid' => array('type' => EntityAnalyzer::SETTER, 'column' => 'uid'), 'getCn' => array('type' => EntityAnalyzer::GETTER, 'column' => 'cn'), 'setCn' => array('type' => EntityAnalyzer::SETTER, 'column' => 'cn'), 'getSn' => array('type' => EntityAnalyzer::GETTER, 'column' => 'sn'), 'setSn' => array('type' => EntityAnalyzer::SETTER, 'column' => 'sn'), 'getGivenName' => array('type' => EntityAnalyzer::GETTER, 'column' => 'givenName'), 'setGivenName' => array('type' => EntityAnalyzer::SETTER, 'column' => 'givenName'), 'getMail' => array('type' => EntityAnalyzer::GETTER, 'column' => 'mail'), 'setMail' => array('type' => EntityAnalyzer::SETTER, 'column' => 'mail'), 'getTelephoneNumber' => array('type' => EntityAnalyzer::GETTER, 'column' => 'telephoneNumber'), 'addTelephoneNumber' => array('type' => EntityAnalyzer::ADDER, 'column' => 'telephoneNumber'), 'removeTelephoneNumber' => array('type' => EntityAnalyzer::REMOVER, 'column' => 'telephoneNumber'))); }
public function testListRequiredMethod() { $this->assertEquals($this->entityAnalyzer->listRequiredMethod(), array('getCn' => array('type' => EntityAnalyzer::GETTER, 'column' => 'cn'), 'setCn' => array('type' => EntityAnalyzer::SETTER, 'column' => 'cn'), 'getMember' => array('type' => EntityAnalyzer::GETTER, 'column' => 'member'), 'addMember' => array('type' => EntityAnalyzer::ADDER, 'column' => 'member'), 'removeMember' => array('type' => EntityAnalyzer::REMOVER, 'column' => 'member'))); }