result
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
namespace Lucent\Account;
|
||||
|
||||
use Lucent\Channel\ChannelService;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
readonly class AccountService
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Lucent\Account;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Support\Collection;
|
||||
use PhpOption\Option;
|
||||
|
||||
class UserRepo
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Lucent\Channel;
|
||||
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Schema;
|
||||
use Lucent\Schema\Schema\Schema;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
final class Channel
|
||||
{
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
namespace Lucent\Channel;
|
||||
|
||||
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Schema;
|
||||
use Lucent\Schema\Schema\Schema;
|
||||
use Lucent\Schema\SchemaService;
|
||||
use Lucent\Support\Collection;
|
||||
use PhpOption\Option;
|
||||
|
||||
final class ChannelService
|
||||
|
||||
@@ -7,8 +7,8 @@ use Exception;
|
||||
use Illuminate\Console\Command;
|
||||
use Intervention\Image\ImageManager;
|
||||
use Lucent\Channel\ChannelService;
|
||||
use Lucent\Schema\Schema;
|
||||
use Lucent\Schema\Type;
|
||||
use Lucent\Schema\Schema\Schema;
|
||||
use Lucent\Schema\Schema\Type;
|
||||
|
||||
class RebuildThumbnails extends Command
|
||||
{
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Id;
|
||||
namespace Lucent\CommonData;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
@@ -7,8 +7,8 @@ use Lucent\Channel\ChannelService;
|
||||
use Lucent\LucentException;
|
||||
use Lucent\Record\File;
|
||||
use Lucent\Record\QueryRecord;
|
||||
use Lucent\Schema\Schema;
|
||||
use Lucent\Schema\Type;
|
||||
use Lucent\Schema\Schema\Schema;
|
||||
use Lucent\Schema\Schema\Type;
|
||||
|
||||
class FileService
|
||||
{
|
||||
|
||||
@@ -11,7 +11,7 @@ use Illuminate\Support\Str;
|
||||
use Intervention\Image\ImageManagerStatic;
|
||||
use Lucent\LucentException;
|
||||
use Lucent\Record\File as RecordFile;
|
||||
use Lucent\Schema\Schema;
|
||||
use Lucent\Schema\Schema\Schema;
|
||||
use Spatie\ImageOptimizer\OptimizerChainFactory;
|
||||
|
||||
/**
|
||||
|
||||
@@ -13,7 +13,7 @@ use Lucent\Query\Query;
|
||||
use Lucent\Record\Manager;
|
||||
use Lucent\Record\QueryRecord;
|
||||
use Lucent\Record\RecordService;
|
||||
use Lucent\Schema\System;
|
||||
use Lucent\Schema\Schema\System;
|
||||
use Lucent\Schema\Validator\ValidatorException;
|
||||
use Lucent\Svelte\Svelte;
|
||||
use function Lucent\Response\fail;
|
||||
|
||||
@@ -7,10 +7,10 @@ use Lucent\Channel\ChannelService;
|
||||
use Lucent\JsonSchema\Definition;
|
||||
use Lucent\JsonSchema\JsonSchemaService;
|
||||
use Lucent\JsonSchema\SchemaData;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Field\FieldInterface;
|
||||
use Lucent\Schema\Schema;
|
||||
use Lucent\Schema\Type;
|
||||
use Lucent\Schema\Schema\Schema;
|
||||
use Lucent\Schema\Schema\Type;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
class GenerateJsonSchema extends Command
|
||||
{
|
||||
|
||||
@@ -4,7 +4,7 @@ namespace Lucent\JsonSchema;
|
||||
|
||||
use Lucent\JsonSchema\Property\Property;
|
||||
use Lucent\JsonSchema\Property\RefProperty;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Support\Collection;
|
||||
use PhpOption\Option;
|
||||
|
||||
class Definition
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
namespace Lucent\JsonSchema\Property;
|
||||
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Support\Collection;
|
||||
use PhpOption\Option;
|
||||
|
||||
class RefProperty implements Property
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
namespace Lucent\JsonSchema;
|
||||
|
||||
use Lucent\JsonSchema\Property\Property;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
class SchemaData
|
||||
{
|
||||
|
||||
+1
-1
@@ -3,8 +3,8 @@
|
||||
namespace Lucent\Query;
|
||||
|
||||
use Lucent\Edge\Edge;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Record\QueryRecord;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
final class Graph
|
||||
{
|
||||
|
||||
+1
-1
@@ -5,13 +5,13 @@ namespace Lucent\Query;
|
||||
use Illuminate\Database\Query\Builder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Lucent\Edge\Edge;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Query\DatabaseGraph\DatabaseGraph;
|
||||
use Lucent\Query\Filter\AndFilter;
|
||||
use Lucent\Query\Filter\OrFilter;
|
||||
use Lucent\Record\InputFormatter;
|
||||
use Lucent\Record\QueryRecord;
|
||||
use Lucent\Record\Record;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
final class Query
|
||||
{
|
||||
|
||||
@@ -5,16 +5,16 @@ namespace Lucent\Record;
|
||||
use Illuminate\Support\Str;
|
||||
use Lucent\Account\AuthService;
|
||||
use Lucent\Channel\ChannelService;
|
||||
use Lucent\CommonData\Id;
|
||||
use Lucent\Edge\Edge;
|
||||
use Lucent\Edge\EdgeCollection;
|
||||
use Lucent\Edge\EdgeService;
|
||||
use Lucent\File\FileService;
|
||||
use Lucent\Id\Id;
|
||||
use Lucent\LucentException;
|
||||
use Lucent\Query\Query;
|
||||
use Lucent\Revision\RevisionService;
|
||||
use Lucent\Schema\Field\FieldInterface;
|
||||
use Lucent\Schema\Schema;
|
||||
use Lucent\Schema\Schema\Schema;
|
||||
use Lucent\Schema\Validator\Validator;
|
||||
use Lucent\Schema\Validator\ValidatorException;
|
||||
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Lucent\Record;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Lucent\Schema\Schema;
|
||||
|
||||
readonly class System
|
||||
{
|
||||
|
||||
@@ -3,14 +3,11 @@
|
||||
namespace Lucent\Revision;
|
||||
|
||||
use Illuminate\Support\Str;
|
||||
use Lucent\Edge\Edge;
|
||||
use Lucent\Edge\EdgeCollection;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Record\File;
|
||||
use Lucent\Record\Record;
|
||||
use Lucent\Record\RecordData;
|
||||
use Lucent\Record\System;
|
||||
use stdClass;
|
||||
|
||||
readonly class Revision
|
||||
{
|
||||
|
||||
@@ -5,10 +5,10 @@ namespace Lucent\Revision;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Lucent\Edge\Edge;
|
||||
use Lucent\Edge\EdgeCollection;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Record\File;
|
||||
use Lucent\Record\RecordData;
|
||||
use Lucent\Record\System;
|
||||
use Lucent\Support\Collection;
|
||||
use PhpOption\Option;
|
||||
use stdClass;
|
||||
|
||||
|
||||
@@ -3,10 +3,9 @@
|
||||
namespace Lucent\Revision;
|
||||
|
||||
use Lucent\Channel\ChannelService;
|
||||
use Lucent\Edge\Edge;
|
||||
use Lucent\Edge\EdgeCollection;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Record\Record;
|
||||
use Lucent\Support\Collection;
|
||||
use PhpOption\Option;
|
||||
|
||||
readonly class RevisionService
|
||||
|
||||
@@ -4,12 +4,11 @@ namespace Lucent\Schema\BlockUi;
|
||||
|
||||
use Lucent\JsonSchema\Property\Property;
|
||||
use Lucent\JsonSchema\Property\RefProperty;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Field\FieldDataInterface;
|
||||
use Lucent\Schema\Field\FieldInfo;
|
||||
use Lucent\Schema\Field\FieldInterface;
|
||||
use Lucent\Schema\Field\FieldType;
|
||||
use Lucent\Schema\Validator\MinMaxInterface;
|
||||
use Lucent\Support\Collection;
|
||||
use PhpOption\Option;
|
||||
|
||||
class File implements FieldInterface, MinMaxInterface
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace Lucent\Schema\Commands;
|
||||
|
||||
use DirectoryIterator;
|
||||
use Illuminate\Console\Command;
|
||||
use Lucent\Schema\Schema;
|
||||
use Lucent\Schema\Schema\Schema;
|
||||
use Lucent\Schema\Schema\Type;
|
||||
use Lucent\Schema\SchemaService;
|
||||
use Lucent\Schema\Type;
|
||||
|
||||
class CompileSchemas extends Command
|
||||
{
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Schema;
|
||||
|
||||
interface Schema
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Schema;
|
||||
namespace Lucent\Schema\Schema;
|
||||
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Field\FieldInterface;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
class BlockSchema implements Schema
|
||||
{
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Schema;
|
||||
namespace Lucent\Schema\Schema;
|
||||
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Field\FieldInterface;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
class CollectionSchema implements Schema
|
||||
{
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Schema;
|
||||
namespace Lucent\Schema\Schema;
|
||||
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Field\FieldDataInterface;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
class EdgeSchema implements Schema
|
||||
{
|
||||
@@ -1,9 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Schema;
|
||||
namespace Lucent\Schema\Schema;
|
||||
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Field\FieldInterface;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
class FilesSchema implements Schema
|
||||
{
|
||||
@@ -0,0 +1,9 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Schema\Schema;
|
||||
|
||||
interface Schema
|
||||
{
|
||||
|
||||
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Schema;
|
||||
namespace Lucent\Schema\Schema;
|
||||
|
||||
readonly class System
|
||||
{
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Schema;
|
||||
namespace Lucent\Schema\Schema;
|
||||
|
||||
|
||||
enum Type: string
|
||||
@@ -2,8 +2,13 @@
|
||||
|
||||
namespace Lucent\Schema;
|
||||
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Field\FieldInterface;
|
||||
use Lucent\Schema\Schema\BlockSchema;
|
||||
use Lucent\Schema\Schema\CollectionSchema;
|
||||
use Lucent\Schema\Schema\EdgeSchema;
|
||||
use Lucent\Schema\Schema\FilesSchema;
|
||||
use Lucent\Schema\Schema\Schema;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
class SchemaService
|
||||
{
|
||||
|
||||
@@ -2,10 +2,10 @@
|
||||
|
||||
namespace Lucent\Schema\Sidebar;
|
||||
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Sidebar\Item\Item;
|
||||
use Lucent\Schema\Sidebar\Item\LinkItem;
|
||||
use Lucent\Schema\Sidebar\Item\SchemaItem;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
class Section
|
||||
{
|
||||
|
||||
@@ -2,13 +2,7 @@
|
||||
|
||||
namespace Lucent\Schema\Sidebar;
|
||||
|
||||
use Hoa\File\Link\Link;
|
||||
use Lucent\Channel\Channel;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Sidebar\Item\Item;
|
||||
use Lucent\Schema\Sidebar\Item\LinkItem;
|
||||
use Lucent\Schema\Sidebar\Item\SchemaItem;
|
||||
use Lucent\Schema\Sidebar\View\ItemData;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
class Sidebar
|
||||
{
|
||||
|
||||
@@ -3,12 +3,10 @@
|
||||
namespace Lucent\Schema\Sidebar;
|
||||
|
||||
|
||||
use Lucent\Channel\Channel;
|
||||
use Lucent\Channel\ChannelService;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\CollectionSchema;
|
||||
use Lucent\Schema\FilesSchema;
|
||||
use Lucent\Schema\Schema;
|
||||
use Lucent\Schema\Schema\CollectionSchema;
|
||||
use Lucent\Schema\Schema\FilesSchema;
|
||||
use Lucent\Schema\Schema\Schema;
|
||||
use Lucent\Schema\Sidebar\Item\Item;
|
||||
use Lucent\Schema\Sidebar\Item\LinkItem;
|
||||
use Lucent\Schema\Sidebar\Item\SchemaItem;
|
||||
|
||||
@@ -4,11 +4,11 @@ namespace Lucent\Schema\Ui;
|
||||
|
||||
use Lucent\JsonSchema\Property\Property;
|
||||
use Lucent\JsonSchema\Property\RefProperty;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Field\FieldInfo;
|
||||
use Lucent\Schema\Field\FieldInterface;
|
||||
use Lucent\Schema\Field\FieldType;
|
||||
use Lucent\Schema\Validator\MinMaxInterface;
|
||||
use Lucent\Support\Collection;
|
||||
use PhpOption\Option;
|
||||
|
||||
class File implements FieldInterface, MinMaxInterface
|
||||
|
||||
@@ -4,11 +4,11 @@ namespace Lucent\Schema\Ui;
|
||||
|
||||
use Lucent\JsonSchema\Property\Property;
|
||||
use Lucent\JsonSchema\Property\RefProperty;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Schema\Field\FieldInfo;
|
||||
use Lucent\Schema\Field\FieldInterface;
|
||||
use Lucent\Schema\Field\FieldType;
|
||||
use Lucent\Schema\Validator\MinMaxInterface;
|
||||
use Lucent\Support\Collection;
|
||||
use PhpOption\Option;
|
||||
|
||||
class Reference implements FieldInterface, MinMaxInterface
|
||||
|
||||
@@ -4,9 +4,9 @@ namespace Lucent\Schema\Validator;
|
||||
|
||||
use Lucent\Channel\ChannelService;
|
||||
use Lucent\Edge\EdgeCollection;
|
||||
use Lucent\Primitive\Collection;
|
||||
use Lucent\Record\RecordData;
|
||||
use Lucent\Schema\Field\FieldInterface;
|
||||
use Lucent\Support\Collection;
|
||||
|
||||
|
||||
class Validator
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Primitive;
|
||||
namespace Lucent\Support;
|
||||
|
||||
use Illuminate\Support\Collection as LaravelCollection;
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Support\Result;
|
||||
|
||||
use PhpOption\None;
|
||||
use PhpOption\Option;
|
||||
use PhpOption\Some;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @template E
|
||||
*
|
||||
* @extends Result<T,E>
|
||||
*/
|
||||
final class Error extends Result
|
||||
{
|
||||
/**
|
||||
* @var E
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* Internal constructor for an error value.
|
||||
*
|
||||
* @param E $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new error value.
|
||||
*
|
||||
* @template F
|
||||
*
|
||||
* @param F $value
|
||||
*
|
||||
* @return Result<T,F>
|
||||
*/
|
||||
public static function create($value): Result
|
||||
{
|
||||
return new self($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the success option value.
|
||||
*
|
||||
* @return Option<T>
|
||||
*/
|
||||
public function success(): Option
|
||||
{
|
||||
return None::create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Map over the success value.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param callable(T):S $f
|
||||
*
|
||||
* @return Result<S,E>
|
||||
*/
|
||||
public function map(callable $f): Result
|
||||
{
|
||||
return self::create($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Flat map over the success value.
|
||||
*
|
||||
* @template S
|
||||
* @template F
|
||||
*
|
||||
* @param callable(T):Result<S,F> $f
|
||||
*
|
||||
* @return Result<S,F>
|
||||
*/
|
||||
public function flatMap(callable $f): Result
|
||||
{
|
||||
/* @var Result<S,F> */
|
||||
return self::create($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error option value.
|
||||
*
|
||||
* @return Option<E>
|
||||
*/
|
||||
public function error(): Option
|
||||
{
|
||||
return Some::create($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map over the error value.
|
||||
*
|
||||
* @template F
|
||||
*
|
||||
* @param callable(E):F $f
|
||||
*
|
||||
* @return Result<T,F>
|
||||
*/
|
||||
public function mapError(callable $f): Result
|
||||
{
|
||||
return self::create($f($this->value));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Support\Result;
|
||||
|
||||
use PhpOption\Option;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @template E
|
||||
*/
|
||||
abstract class Result
|
||||
{
|
||||
/**
|
||||
* Get the success option value.
|
||||
*
|
||||
* @return Option<T>
|
||||
*/
|
||||
abstract public function success(): Option;
|
||||
|
||||
/**
|
||||
* Map over the success value.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param callable(T):S $f
|
||||
*
|
||||
* @return Result<S,E>
|
||||
*/
|
||||
abstract public function map(callable $f): Result;
|
||||
|
||||
/**
|
||||
* Flat map over the success value.
|
||||
*
|
||||
* @template S
|
||||
* @template F
|
||||
*
|
||||
* @param callable(T): Result<S,F> $f
|
||||
*
|
||||
* @return Result<S,F>
|
||||
*/
|
||||
abstract public function flatMap(callable $f): Result;
|
||||
|
||||
/**
|
||||
* Get the error option value.
|
||||
*
|
||||
* @return Option<E>
|
||||
*/
|
||||
abstract public function error(): Option;
|
||||
|
||||
/**
|
||||
* Map over the error value.
|
||||
*
|
||||
* @template F
|
||||
*
|
||||
* @param callable(E):F $f
|
||||
*
|
||||
* @return Result<T,F>
|
||||
*/
|
||||
abstract public function mapError(callable $f): Result;
|
||||
}
|
||||
@@ -0,0 +1,110 @@
|
||||
<?php
|
||||
|
||||
namespace Lucent\Support\Result;
|
||||
|
||||
use PhpOption\None;
|
||||
use PhpOption\Option;
|
||||
use PhpOption\Some;
|
||||
|
||||
/**
|
||||
* @template T
|
||||
* @template E
|
||||
*
|
||||
* @extends Result<T,E>
|
||||
*/
|
||||
final class Success extends Result
|
||||
{
|
||||
/**
|
||||
* @var T
|
||||
*/
|
||||
private $value;
|
||||
|
||||
/**
|
||||
* Internal constructor for a success value.
|
||||
*
|
||||
* @param T $value
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
private function __construct($value)
|
||||
{
|
||||
$this->value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new error value.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param S $value
|
||||
*
|
||||
* @return Result<S,E>
|
||||
*/
|
||||
public static function create($value): Result
|
||||
{
|
||||
return new self($value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the success option value.
|
||||
*
|
||||
* @return Option<T>
|
||||
*/
|
||||
public function success(): Option
|
||||
{
|
||||
return Some::create($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Map over the success value.
|
||||
*
|
||||
* @template S
|
||||
*
|
||||
* @param callable(T):S $f
|
||||
*
|
||||
* @return Result<S,E>
|
||||
*/
|
||||
public function map(callable $f): Result
|
||||
{
|
||||
return self::create($f($this->value));
|
||||
}
|
||||
|
||||
/**
|
||||
* Flat map over the success value.
|
||||
*
|
||||
* @template S
|
||||
* @template F
|
||||
*
|
||||
* @param callable(T):Result<S,F> $f
|
||||
*
|
||||
* @return Result<S,F>
|
||||
*/
|
||||
public function flatMap(callable $f): Result
|
||||
{
|
||||
return $f($this->value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the error option value.
|
||||
*
|
||||
* @return Option<E>
|
||||
*/
|
||||
public function error(): Option
|
||||
{
|
||||
return None::create();
|
||||
}
|
||||
|
||||
/**
|
||||
* Map over the error value.
|
||||
*
|
||||
* @template F
|
||||
*
|
||||
* @param callable(E):F $f
|
||||
*
|
||||
* @return Result<T,F>
|
||||
*/
|
||||
public function mapError(callable $f): Result
|
||||
{
|
||||
return self::create($this->value);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user