| @@ 503-520 (lines=18) @@ | ||
| 500 | * |
|
| 501 | * @return string|false method name if it exists |
|
| 502 | */ |
|
| 503 | public static function getMutator($property) |
|
| 504 | { |
|
| 505 | $class = get_called_class(); |
|
| 506 | ||
| 507 | $k = $class.':'.$property; |
|
| 508 | if (!array_key_exists($k, self::$mutators)) { |
|
| 509 | $inflector = Inflector::get(); |
|
| 510 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 511 | ||
| 512 | if (!method_exists($class, $method)) { |
|
| 513 | $method = false; |
|
| 514 | } |
|
| 515 | ||
| 516 | self::$mutators[$k] = $method; |
|
| 517 | } |
|
| 518 | ||
| 519 | return self::$mutators[$k]; |
|
| 520 | } |
|
| 521 | ||
| 522 | /** |
|
| 523 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 531-548 (lines=18) @@ | ||
| 528 | * |
|
| 529 | * @return string|false method name if it exists |
|
| 530 | */ |
|
| 531 | public static function getAccessor($property) |
|
| 532 | { |
|
| 533 | $class = get_called_class(); |
|
| 534 | ||
| 535 | $k = $class.':'.$property; |
|
| 536 | if (!array_key_exists($k, self::$accessors)) { |
|
| 537 | $inflector = Inflector::get(); |
|
| 538 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 539 | ||
| 540 | if (!method_exists($class, $method)) { |
|
| 541 | $method = false; |
|
| 542 | } |
|
| 543 | ||
| 544 | self::$accessors[$k] = $method; |
|
| 545 | } |
|
| 546 | ||
| 547 | return self::$accessors[$k]; |
|
| 548 | } |
|
| 549 | ||
| 550 | ///////////////////////////// |
|
| 551 | // CRUD Operations |
|