| @@ 517-534 (lines=18) @@ | ||
| 514 | * |
|
| 515 | * @return string|false method name if it exists |
|
| 516 | */ |
|
| 517 | public static function getMutator($property) |
|
| 518 | { |
|
| 519 | $class = get_called_class(); |
|
| 520 | ||
| 521 | $k = $class.':'.$property; |
|
| 522 | if (!array_key_exists($k, self::$mutators)) { |
|
| 523 | $inflector = Inflector::get(); |
|
| 524 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 525 | ||
| 526 | if (!method_exists($class, $method)) { |
|
| 527 | $method = false; |
|
| 528 | } |
|
| 529 | ||
| 530 | self::$mutators[$k] = $method; |
|
| 531 | } |
|
| 532 | ||
| 533 | return self::$mutators[$k]; |
|
| 534 | } |
|
| 535 | ||
| 536 | /** |
|
| 537 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 545-562 (lines=18) @@ | ||
| 542 | * |
|
| 543 | * @return string|false method name if it exists |
|
| 544 | */ |
|
| 545 | public static function getAccessor($property) |
|
| 546 | { |
|
| 547 | $class = get_called_class(); |
|
| 548 | ||
| 549 | $k = $class.':'.$property; |
|
| 550 | if (!array_key_exists($k, self::$accessors)) { |
|
| 551 | $inflector = Inflector::get(); |
|
| 552 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 553 | ||
| 554 | if (!method_exists($class, $method)) { |
|
| 555 | $method = false; |
|
| 556 | } |
|
| 557 | ||
| 558 | self::$accessors[$k] = $method; |
|
| 559 | } |
|
| 560 | ||
| 561 | return self::$accessors[$k]; |
|
| 562 | } |
|
| 563 | ||
| 564 | /** |
|
| 565 | * Checks if a given property is a relationship. |
|