Code Duplication    Length = 13-13 lines in 2 locations

app/Device.php 2 locations

@@ 143-155 (lines=13) @@
140
     * @param  string  $value
141
     * @return void
142
     */
143
    public function setOpenTimeAttribute($value)
144
    {
145
        //If the user is logged in then use there preferred timezone
146
        if (Auth::check())
147
        {
148
            $time = new Carbon($value, Auth::user()->timezone);
149
            $time = $time->setTimezone('UTC');
150
        }
151
        else
152
            $time = new Carbon($value, 'UTC');
153
        
154
        $this->attributes['open_time'] = $time->format('H:i:s');
155
    }
156
    
157
    /**
158
     * Set the close time to UTC
@@ 165-177 (lines=13) @@
162
     * @param  string  $value
163
     * @return void
164
     */
165
    public function setCloseTimeAttribute($value)
166
    {
167
        //If the user is logged in then use there preferred timezone
168
        if (Auth::check())
169
        {
170
            $time = new Carbon($value, Auth::user()->timezone);
171
            $time = $time->setTimezone('UTC');
172
        }
173
        else
174
            $time = new Carbon($value, 'UTC');
175
        
176
        $this->attributes['close_time'] = $time->format('H:i:s');
177
    }
178
    
179
    /**
180
     * Scope a query to only include devices belonging to a given location