Couldn't this just be:
```php
public function put($path, $contents, $visibilitt = null)
{
    if ($this->has($path)) {
        return $this->update($path, $contents, $visibility);
    }

    return $this->write($path, $contents, $visibility);
}
```