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