| @@ 489-506 (lines=18) @@ | ||
| 486 | * |
|
| 487 | * @return string|false method name if it exists |
|
| 488 | */ |
|
| 489 | public static function getMutator($property) |
|
| 490 | { |
|
| 491 | $class = get_called_class(); |
|
| 492 | ||
| 493 | $k = $class.':'.$property; |
|
| 494 | if (!array_key_exists($k, self::$mutators)) { |
|
| 495 | $inflector = Inflector::get(); |
|
| 496 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 497 | ||
| 498 | if (!method_exists($class, $method)) { |
|
| 499 | $method = false; |
|
| 500 | } |
|
| 501 | ||
| 502 | self::$mutators[$k] = $method; |
|
| 503 | } |
|
| 504 | ||
| 505 | return self::$mutators[$k]; |
|
| 506 | } |
|
| 507 | ||
| 508 | /** |
|
| 509 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 517-534 (lines=18) @@ | ||
| 514 | * |
|
| 515 | * @return string|false method name if it exists |
|
| 516 | */ |
|
| 517 | public static function getAccessor($property) |
|
| 518 | { |
|
| 519 | $class = get_called_class(); |
|
| 520 | ||
| 521 | $k = $class.':'.$property; |
|
| 522 | if (!array_key_exists($k, self::$accessors)) { |
|
| 523 | $inflector = Inflector::get(); |
|
| 524 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 525 | ||
| 526 | if (!method_exists($class, $method)) { |
|
| 527 | $method = false; |
|
| 528 | } |
|
| 529 | ||
| 530 | self::$accessors[$k] = $method; |
|
| 531 | } |
|
| 532 | ||
| 533 | return self::$accessors[$k]; |
|
| 534 | } |
|
| 535 | ||
| 536 | /** |
|
| 537 | * Checks if a given property is a relationship. |
|