| @@ 565-582 (lines=18) @@ | ||
| 562 | * |
|
| 563 | * @return string|false method name if it exists |
|
| 564 | */ |
|
| 565 | public static function getMutator($property) |
|
| 566 | { |
|
| 567 | $class = get_called_class(); |
|
| 568 | ||
| 569 | $k = $class.':'.$property; |
|
| 570 | if (!array_key_exists($k, self::$mutators)) { |
|
| 571 | $inflector = Inflector::get(); |
|
| 572 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 573 | ||
| 574 | if (!method_exists($class, $method)) { |
|
| 575 | $method = false; |
|
| 576 | } |
|
| 577 | ||
| 578 | self::$mutators[$k] = $method; |
|
| 579 | } |
|
| 580 | ||
| 581 | return self::$mutators[$k]; |
|
| 582 | } |
|
| 583 | ||
| 584 | /** |
|
| 585 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 593-610 (lines=18) @@ | ||
| 590 | * |
|
| 591 | * @return string|false method name if it exists |
|
| 592 | */ |
|
| 593 | public static function getAccessor($property) |
|
| 594 | { |
|
| 595 | $class = get_called_class(); |
|
| 596 | ||
| 597 | $k = $class.':'.$property; |
|
| 598 | if (!array_key_exists($k, self::$accessors)) { |
|
| 599 | $inflector = Inflector::get(); |
|
| 600 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 601 | ||
| 602 | if (!method_exists($class, $method)) { |
|
| 603 | $method = false; |
|
| 604 | } |
|
| 605 | ||
| 606 | self::$accessors[$k] = $method; |
|
| 607 | } |
|
| 608 | ||
| 609 | return self::$accessors[$k]; |
|
| 610 | } |
|
| 611 | ||
| 612 | /** |
|
| 613 | * Checks if a given property is a relationship. |
|