ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ILIAS\WebDAV\Entity\File Class Reference
+ Inheritance diagram for ILIAS\WebDAV\Entity\File:
+ Collaboration diagram for ILIAS\WebDAV\Entity\File:

Public Member Functions

 put (mixed $data)
 
 get ()
 
 getContentType ()
 
 getETag ()
 
 getSize ()
 
- Public Member Functions inherited from ILIAS\WebDAV\Entity\BaseEntity
 __construct (protected Factory $factory, protected string $path, protected ?Proxy $object_proxy=null)
 
 delete ()
 
 getName ()
 
 setName ($name)
 
 getLastModified ()
 
 getObjectProxy ()
 
 getPath ()
 
- Public Member Functions inherited from ILIAS\WebDAV\Entity\Entity
 __construct (Factory $factory, string $path, ?Proxy $proxy=null,)
 
 getObjectProxy ()
 
 getPath ()
 

Private Member Functions

 generateEtag (mixed $data=null)
 

Detailed Description

Author
Fabian Schmid fabia.nosp@m.n@sr.nosp@m..solu.nosp@m.tion.nosp@m.s

Definition at line 29 of file File.php.

Member Function Documentation

◆ generateEtag()

ILIAS\WebDAV\Entity\File::generateEtag ( mixed  $data = null)
private

Definition at line 33 of file File.php.

33 : ?string
34 {
35 try {
36 if (is_resource($data)) {
37 $data = stream_get_contents($data);
38 }
39
40 $data = $data ??
41 $this->object_proxy !== null
42 ? $this->object_proxy->getStreamHandler()->get()->getContents()
43 : null; // maybe to much?
44
45 if (empty($data)) {
46 return null;
47 }
48
49 return '"' . md5((string) $data) . '"';
50 } catch (\Throwable $e) {
51 return null;
52 }
53 }

References $data, and Vendor\Package\$e.

Referenced by ILIAS\WebDAV\Entity\File\getETag(), and ILIAS\WebDAV\Entity\File\put().

+ Here is the caller graph for this function:

◆ get()

ILIAS\WebDAV\Entity\File::get ( )

Definition at line 70 of file File.php.

70 : mixed
71 {
72 return $this->getObjectProxy()?->getStreamHandler()?->get()?->detach();
73 }

References ILIAS\WebDAV\Entity\BaseEntity\getObjectProxy().

+ Here is the call graph for this function:

◆ getContentType()

ILIAS\WebDAV\Entity\File::getContentType ( )

Definition at line 75 of file File.php.

75 : ?string
76 {
77 return $this->object_proxy?->getContentType();
78 }

◆ getETag()

ILIAS\WebDAV\Entity\File::getETag ( )

Definition at line 80 of file File.php.

80 : ?string
81 {
82 return $this->generateEtag();
83 }
generateEtag(mixed $data=null)
Definition: File.php:33

References ILIAS\WebDAV\Entity\File\generateEtag().

+ Here is the call graph for this function:

◆ getSize()

ILIAS\WebDAV\Entity\File::getSize ( )

Definition at line 85 of file File.php.

85 : ?int
86 {
87 return $this->object_proxy?->getSize();
88 }

◆ put()

ILIAS\WebDAV\Entity\File::put ( mixed  $data)

Definition at line 55 of file File.php.

55 : ?string
56 {
57 $title = $this->getName();
58 $is_empty = $this->isEmpty($data);
59 $this->getObjectProxy()
60 ?->getStreamHandler()
61 ?->put(
62 $title,
63 $data,
64 !$is_empty
65 );
66
67 return $this->generateEtag($data);
68 }

References $data, ILIAS\WebDAV\Entity\File\generateEtag(), ILIAS\WebDAV\Entity\BaseEntity\getName(), and ILIAS\WebDAV\Entity\BaseEntity\getObjectProxy().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: