Imported into new repository.

This commit is contained in:
flash 2022-09-13 15:13:11 +02:00
commit ac2255d24d
187 changed files with 15021 additions and 0 deletions
src/Http/Content

View file

@ -0,0 +1,36 @@
<?php
// StringContent.php
// Created: 2022-02-10
// Updated: 2022-02-27
namespace Index\Http\Content;
use Stringable;
class StringContent implements Stringable, IHttpContent {
private string $string;
public function __construct(string $string) {
$this->string = $string;
}
public function getString(): string {
return $this->string;
}
public function __toString(): string {
return $this->string;
}
public static function fromObject(string $string): StringContent {
return new StringContent($string);
}
public static function fromFile(string $path): StringContent {
return new StringContent(file_get_contents($path));
}
public static function fromRequest(): StringContent {
return self::fromFile('php://input');
}
}