| @@ 403-420 (lines=18) @@ | ||
| 400 | * |
|
| 401 | * @return string|false method name if it exists |
|
| 402 | */ |
|
| 403 | public static function getMutator($property) |
|
| 404 | { |
|
| 405 | $class = get_called_class(); |
|
| 406 | ||
| 407 | $k = $class.':'.$property; |
|
| 408 | if (!array_key_exists($k, self::$mutators)) { |
|
| 409 | $inflector = Inflector::get(); |
|
| 410 | $method = 'set'.$inflector->camelize($property).'Value'; |
|
| 411 | ||
| 412 | if (!method_exists($class, $method)) { |
|
| 413 | $method = false; |
|
| 414 | } |
|
| 415 | ||
| 416 | self::$mutators[$k] = $method; |
|
| 417 | } |
|
| 418 | ||
| 419 | return self::$mutators[$k]; |
|
| 420 | } |
|
| 421 | ||
| 422 | /** |
|
| 423 | * Gets the accessor method name for a given proeprty name. |
|
| @@ 431-448 (lines=18) @@ | ||
| 428 | * |
|
| 429 | * @return string|false method name if it exists |
|
| 430 | */ |
|
| 431 | public static function getAccessor($property) |
|
| 432 | { |
|
| 433 | $class = get_called_class(); |
|
| 434 | ||
| 435 | $k = $class.':'.$property; |
|
| 436 | if (!array_key_exists($k, self::$accessors)) { |
|
| 437 | $inflector = Inflector::get(); |
|
| 438 | $method = 'get'.$inflector->camelize($property).'Value'; |
|
| 439 | ||
| 440 | if (!method_exists($class, $method)) { |
|
| 441 | $method = false; |
|
| 442 | } |
|
| 443 | ||
| 444 | self::$accessors[$k] = $method; |
|
| 445 | } |
|
| 446 | ||
| 447 | return self::$accessors[$k]; |
|
| 448 | } |
|
| 449 | ||
| 450 | /** |
|
| 451 | * Checks if a given property is a relationship. |
|