add diagrams, fix documentation
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
a1910d1167
commit
b08e761abb
@ -0,0 +1,47 @@
|
|||||||
|
@startuml
|
||||||
|
|
||||||
|
class HttpRequest implements ArrayAccess {
|
||||||
|
- data: array
|
||||||
|
+ __construct(data: array)
|
||||||
|
|
||||||
|
+ offsetExists(offset: mixed): bool
|
||||||
|
+ offsetGet(offset: mixed): mixed
|
||||||
|
+ offsetSet(offset: mixed, value: mixed)
|
||||||
|
+ offsetUnset(offset: mixed)
|
||||||
|
|
||||||
|
+ <u>from(request: array, fails: &array, schema: array): HttpRequest
|
||||||
|
+ <u>fromPayload(fails: &array, schema: array): HttpRequest
|
||||||
|
}
|
||||||
|
|
||||||
|
class HttpResponse {
|
||||||
|
- code: int
|
||||||
|
+ __construct(code: int)
|
||||||
|
+ getCode(): int
|
||||||
|
|
||||||
|
<u>fromCode(code: int): HttpResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
class JsonHttpResponse extends HttpResponse {
|
||||||
|
- payload: mixed
|
||||||
|
+ __construct(payload: mixed, code: int = HttpCodes::OK)
|
||||||
|
+ getJson(): string
|
||||||
|
}
|
||||||
|
|
||||||
|
class ViewHttpResponse extends HttpResponse {
|
||||||
|
+ <u>TWIG_VIEW: int {frozen}
|
||||||
|
+ <u>REACT_VIEW: int {frozen}
|
||||||
|
|
||||||
|
- file: string
|
||||||
|
- arguments: array
|
||||||
|
- kind: int
|
||||||
|
|
||||||
|
+ __construct(kind: int, file: string, arguments: array, code: int = HttpCodes::OK)
|
||||||
|
+ getViewKind(): int
|
||||||
|
+ getFile(): string
|
||||||
|
+ getArguments(): array
|
||||||
|
|
||||||
|
+ <u>twig(file: string, arguments: array, code: int = HttpCodes::OK): ViewHttpResponse
|
||||||
|
+ <u>react(file: string, arguments: array, code: int = HttpCodes::OK): ViewHttpResponse
|
||||||
|
}
|
||||||
|
|
||||||
|
@enduml
|
@ -0,0 +1,59 @@
|
|||||||
|
@startuml
|
||||||
|
|
||||||
|
abstract class Validator {
|
||||||
|
+ validate(name: string, val: mixed): array
|
||||||
|
+ then(other: Validator): Validator
|
||||||
|
}
|
||||||
|
|
||||||
|
class ComposedValidator extends Validator {
|
||||||
|
- first: Validator
|
||||||
|
- then: Validator
|
||||||
|
|
||||||
|
+ __construct(first: Validator, then: Validator)
|
||||||
|
validate(name: string, val: mixed): array
|
||||||
|
}
|
||||||
|
|
||||||
|
class SimpleFunctionValidator extends Validator {
|
||||||
|
- predicate: callable
|
||||||
|
- error_factory: callable
|
||||||
|
|
||||||
|
+ __construct(predicate: callable, errorsFactory: callable)
|
||||||
|
+ validate(name: string, val: mixed): array
|
||||||
|
}
|
||||||
|
|
||||||
|
class ValidationFail implements JsonSerialize {
|
||||||
|
- kind: string
|
||||||
|
- message: string
|
||||||
|
|
||||||
|
+ __construct(kind: string, message: string)
|
||||||
|
+ getMessage(): string
|
||||||
|
+ getKind(): string
|
||||||
|
+ jsonSerialize()
|
||||||
|
|
||||||
|
+ <u>notFound(message: string): ValidationFail
|
||||||
|
}
|
||||||
|
|
||||||
|
class FieldValidationFail extends ValidationFail {
|
||||||
|
- fieldName: string
|
||||||
|
+ __construct(fieldName: string, message: string)
|
||||||
|
+ getFieldName(): string
|
||||||
|
+ jsonSerialize()
|
||||||
|
|
||||||
|
+ <u>invalidChars(fieldName: string): FieldValidationFail
|
||||||
|
+ <u>empty(fieldName: string): FieldValidationFail
|
||||||
|
+ <u>missing(fieldName: string): FieldValidationFail
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
class Validation {
|
||||||
|
<u> + validate(val: mixed, valName: string, failures: &array, validators: Validator...): bool
|
||||||
|
}
|
||||||
|
|
||||||
|
class Validators {
|
||||||
|
+ <u>nonEmpty(): Validator
|
||||||
|
+ <u>shorterThan(limit: int): Validator
|
||||||
|
+ <u>userString(maxLen: int): Validator
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@enduml
|
Loading…
Reference in new issue