| @@ 466-483 (lines=18) @@ | ||
| 463 | * |
|
| 464 | * @return string|false method name if it exists |
|
| 465 | */ |
|
| 466 | public static function getMutator($property) |
|
| 467 | { |
|
| 468 | $class = get_called_class(); |
|
| 469 | ||
| 470 | $k = $class.':'.$property; |
|
| 471 | if (!array_key_exists($k, self::$mutators)) { |
|
| 472 | $inflector = Inflector::get(); |
|
| 473 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 474 | ||
| 475 | if (!method_exists($class, $method)) { |
|
| 476 | $method = false; |
|
| 477 | } |
|
| 478 | ||
| 479 | self::$mutators[$k] = $method; |
|
| 480 | } |
|
| 481 | ||
| 482 | return self::$mutators[$k]; |
|
| 483 | } |
|
| 484 | ||
| 485 | /** |
|
| 486 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 494-511 (lines=18) @@ | ||
| 491 | * |
|
| 492 | * @return string|false method name if it exists |
|
| 493 | */ |
|
| 494 | public static function getAccessor($property) |
|
| 495 | { |
|
| 496 | $class = get_called_class(); |
|
| 497 | ||
| 498 | $k = $class.':'.$property; |
|
| 499 | if (!array_key_exists($k, self::$accessors)) { |
|
| 500 | $inflector = Inflector::get(); |
|
| 501 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 502 | ||
| 503 | if (!method_exists($class, $method)) { |
|
| 504 | $method = false; |
|
| 505 | } |
|
| 506 | ||
| 507 | self::$accessors[$k] = $method; |
|
| 508 | } |
|
| 509 | ||
| 510 | return self::$accessors[$k]; |
|
| 511 | } |
|
| 512 | ||
| 513 | /** |
|
| 514 | * Checks if a given property is a relationship. |
|