@@ 30-39 (lines=10) @@ | ||
27 | * @param array $attributes |
|
28 | * @return static |
|
29 | */ |
|
30 | public static function create(array $mapping, array $attributes) |
|
31 | { |
|
32 | $blog = new Blog; |
|
33 | ||
34 | array_walk($mapping, function (&$name, $key) use (&$blog, &$attributes) { |
|
35 | $blog->$key = (isset($attributes[$name])) ? $attributes[$name] : null; |
|
36 | }); |
|
37 | ||
38 | return $blog; |
|
39 | } |
|
40 | } |
|
41 |
@@ 45-54 (lines=10) @@ | ||
42 | * @param array $attributes |
|
43 | * @return static |
|
44 | */ |
|
45 | public static function create(array $mapping, array $attributes) |
|
46 | { |
|
47 | $profile = new Profile; |
|
48 | ||
49 | array_walk($mapping, function (&$name, $key) use (&$profile, &$attributes) { |
|
50 | $profile->$key = (isset($attributes[$name])) ? $attributes[$name] : null; |
|
51 | }); |
|
52 | ||
53 | return $profile; |
|
54 | } |
|
55 | } |
|
56 |