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