@@ -41,10 +41,11 @@ public function __construct($root)
4141 */
4242 public function write (BlockInterface $ block )
4343 {
44- file_put_contents (
45- $ this ->getFilename ($ block ->getIdentifier ()),
46- serialize ($ block )
47- );
44+ $ filename = $ this ->getFilename ($ block ->getIdentifier ());
45+
46+ if (false === file_put_contents ($ filename , serialize ($ block ))) {
47+ throw new \Exception ('Write failed ' );
48+ }
4849
4950 return true ;
5051 }
@@ -55,7 +56,11 @@ public function write(BlockInterface $block)
5556 public function touch (BlockInterface $ block )
5657 {
5758 $ filename = $ this ->getFilename ($ block ->getIdentifier ());
58- touch ($ filename );
59+
60+ if (false === touch ($ filename )) {
61+ throw new \Exception ('Touch failed ' );
62+ }
63+
5964 $ updatedAt = new \DateTime ();
6065 $ updatedAt ->setTimestamp (filemtime ($ filename ));
6166 $ block ->setUpdatedAt ($ updatedAt );
@@ -72,7 +77,10 @@ public function remove(BlockInterface $block)
7277 return false ;
7378 }
7479
75- unlink ($ this ->getFilename ($ block ->getIdentifier ()));
80+ $ filename = $ this ->getFilename ($ block ->getIdentifier ());
81+ if (false === unlink ($ filename )) {
82+ throw new \Exception ('Unlink failed ' );
83+ }
7684
7785 return true ;
7886 }
@@ -82,7 +90,8 @@ public function remove(BlockInterface $block)
8290 */
8391 public function exists (IdentifierInterface $ identifier )
8492 {
85- return file_exists ($ this ->getFilename ($ identifier ));
93+ $ filename = $ this ->getFilename ($ identifier );
94+ return file_exists ($ filename );
8695 }
8796
8897 /**
0 commit comments