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