| @@ 423-440 (lines=18) @@ | ||
| 420 | * |
|
| 421 | * @return string|false method name if it exists |
|
| 422 | */ |
|
| 423 | public static function getMutator($property) |
|
| 424 | { |
|
| 425 | $class = get_called_class(); |
|
| 426 | ||
| 427 | $k = $class.':'.$property; |
|
| 428 | if (!array_key_exists($k, self::$mutators)) { |
|
| 429 | $inflector = Inflector::get(); |
|
| 430 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 431 | ||
| 432 | if (!method_exists($class, $method)) { |
|
| 433 | $method = false; |
|
| 434 | } |
|
| 435 | ||
| 436 | self::$mutators[$k] = $method; |
|
| 437 | } |
|
| 438 | ||
| 439 | return self::$mutators[$k]; |
|
| 440 | } |
|
| 441 | ||
| 442 | /** |
|
| 443 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 451-468 (lines=18) @@ | ||
| 448 | * |
|
| 449 | * @return string|false method name if it exists |
|
| 450 | */ |
|
| 451 | public static function getAccessor($property) |
|
| 452 | { |
|
| 453 | $class = get_called_class(); |
|
| 454 | ||
| 455 | $k = $class.':'.$property; |
|
| 456 | if (!array_key_exists($k, self::$accessors)) { |
|
| 457 | $inflector = Inflector::get(); |
|
| 458 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 459 | ||
| 460 | if (!method_exists($class, $method)) { |
|
| 461 | $method = false; |
|
| 462 | } |
|
| 463 | ||
| 464 | self::$accessors[$k] = $method; |
|
| 465 | } |
|
| 466 | ||
| 467 | return self::$accessors[$k]; |
|
| 468 | } |
|
| 469 | ||
| 470 | /** |
|
| 471 | * Checks if a given property is a relationship. |
|