Code Duplication    Length = 11-11 lines in 2 locations

src/Model.php 2 locations

@@ 52-62 (lines=11) @@
49
     * @param  mixed   $default
50
     * @return mixed
51
     */
52
    public function get($key, $default = null)
53
    {
54
        $current = $this->data;
55
        foreach (explode('.', $key) as $segment) {
56
            if (!isset($current->{$segment})) {
57
                return $default;
58
            }
59
            $current = $current->{$segment};
60
        }
61
        return $current;
62
    }
63
64
    /**
65
     * Check if an item or items exist in an array using "dot" notation.
@@ 70-80 (lines=11) @@
67
     * @param  string  $key
68
     * @return mixed
69
     */
70
    public function has($key)
71
    {
72
        $current = $this->data;
73
        foreach (explode('.', $key) as $segment) {
74
            if (!isset($current->{$segment})) {
75
                return false;
76
            }
77
            $current = $current->{$segment};
78
        }
79
        return true;
80
    }
81
82
    /**
83
     * Get a string representation of the object