public function getProperty($methodName) { $pattern = implode('|', array_merge(self::ACCESSOR_PREFIXES, self::MUTATOR_PREFIXES)); if (preg_match('/^(' . $pattern . ')(.+)$/i', $methodName, $matches)) { return $matches[2]; } }
public function testWithBadMethodName() { $methodName = 'delGerard'; $reflection = new Reflection(); $return = $reflection->getProperty($methodName); $this->assertNotEquals($return, 'Gerard'); $this->assertEquals($return, null); }