Skip to content
yarunoka.dev

Reference

View Markdown

final readonly class Schedule implements Illuminate\Contracts\Support\Arrayable, Illuminate\Contracts\Database\Eloquent\Castable

The wrapper the cast answers a schedule column with — one schedule of the DSL. The core’s YrnkSchedule stays exposed as a property, so everything php-core can do with a schedule stays reachable. The firing vocabulary the core deliberately lacks (isDue) lives here — convenience is the bridge’s business.

readonly, so a change is a reassignment ($routine->schedule = $new).

  • YrnkSchedule $yrnkSchedule
  • __construct(YrnkSchedule $yrnkSchedule)
  • isDue(DateTimeInterface $at, DateTimeInterface $since): bool — Is there a scheduled point in the half-open interval (since, at] — the firing decision, the engine’s hasMatchIn as it is.
  • toArray(): array — The raw form of the DSL (RawSchedule) — the model’s toArray / toJson show the stored spelling as it is.
  • castUsing(array $arguments): string — The Castable form: casts() takes this wrapper’s class name alone.

final readonly class Schedules implements Illuminate\Contracts\Support\Arrayable, Illuminate\Contracts\Database\Eloquent\Castable

The wrapper the cast answers a schedules-part column with — a list of Schedule whose firing decision composes with any. The elements are the bridge’s Schedule, not bare YrnkSchedule, so each of them carries the same vocabulary alone as it does in the list.

readonly, so a change is a reassignment ($routine->schedules = $new).

  • array $schedules
  • __construct(array $schedules)
  • isDue(DateTimeInterface $at, DateTimeInterface $since): bool — Is there a scheduled point of any schedule in the half-open interval (since, at] — the firing decision, composed with any.
  • toArray(): array — The raw form of the DSL (list) — the model’s toArray / toJson show the stored spelling as it is.
  • castUsing(array $arguments): string — The Castable form: casts() takes this wrapper’s class name alone.

class YarunokaServiceProvider extends Illuminate\Support\ServiceProvider

The Laravel integration of Yarunoka. Binds YrnkEvaluator / YrnkParser into the container, built from the config (timezone / calendar / resolvers) as the environment.

The bindings are scoped (per request) + If. Scoped, so the freshness of what the resolvers answered rides on the DI scope; If, so a binding the app makes itself always wins. The three date-set layers take an app binding of the layer interface as an override of the config key. The config is read when the environment is first derived within a scope, not at registration — reading it in register() would run ahead of later providers and of a test setting the config.

  • register(): void
  • boot(): void

final class AsYrnk implements Illuminate\Contracts\Database\Eloquent\CastsAttributes, Illuminate\Contracts\Database\Eloquent\ComparesCastableAttributes

The Eloquent cast of a whole-document column (the JSON of a Yrnk document), for storing a timezone / calendar per row. get answers a bare Yrnk — a whole-document column stores “such a document” and grows no judgment conveniences. Whoever wants to judge builds a YrnkEvaluator from the document’s calendar / timezone.

  • get(Model $model, string $key, mixed $value, array $attributes): ?Yrnk
  • set(Model $model, string $key, mixed $value, array $attributes): ?string
  • compare(Model $model, string $key, mixed $firstValue, mixed $secondValue): bool — JSON varies in key order and whitespace as a string, so the decoded arrays are compared to avoid a false dirty (a pointless UPDATE).

final class AsYrnkSchedule implements Illuminate\Contracts\Database\Eloquent\CastsAttributes, Illuminate\Contracts\Database\Eloquent\ComparesCastableAttributes

The Eloquent cast of a schedule column (the JSON of one RawSchedule). The consumer writes Schedule::class (Castable) in casts() and this class is an implementation detail. ScheduleCodec is pulled from the container per call because a cast is constructed with a bare new where DI cannot reach (this also keeps the scope fresh).

  • get(Model $model, string $key, mixed $value, array $attributes): ?Schedule
  • set(Model $model, string $key, mixed $value, array $attributes): ?string
  • compare(Model $model, string $key, mixed $firstValue, mixed $secondValue): bool — JSON varies in key order and whitespace as a string, so the decoded arrays are compared to avoid a false dirty (a pointless UPDATE).

final class AsYrnkSchedules implements Illuminate\Contracts\Database\Eloquent\CastsAttributes, Illuminate\Contracts\Database\Eloquent\ComparesCastableAttributes

The Eloquent cast of a schedules-part column (the JSON of a list). The consumer writes Schedules::class (Castable) in casts() and this class is an implementation detail. ScheduleCodec is pulled from the container per call because a cast is constructed with a bare new where DI cannot reach (this also keeps the scope fresh).

  • get(Model $model, string $key, mixed $value, array $attributes): ?Schedules
  • set(Model $model, string $key, mixed $value, array $attributes): ?string
  • compare(Model $model, string $key, mixed $firstValue, mixed $secondValue): bool — JSON varies in key order and whitespace as a string, so the decoded arrays are compared to avoid a false dirty (a pointless UPDATE).

class InvalidYrnkColumnException extends RuntimeException implements Yarunoka\Exceptions\ExceptionInterface

The data a column held cannot be read as Yrnk. The cast’s get runs in the middle of model retrieval or serialization — a place where the cause is hard to see — so the message names the model and the column.

class ValidYrnk implements Illuminate\Contracts\Validation\ValidationRule

The validation rule of a whole document (a Yrnk document). Tries the construction with YrnkParser (carrying the config’s resolvers) and puts the engine’s message on the validation error as it is.

  • validate(string $attribute, mixed $value, Closure $fail): void

class ValidYrnkSchedule implements Illuminate\Contracts\Validation\ValidationRule

The validation rule of one schedule. Tries the construction with ScheduleCodec (structure + references against the config environment) and puts the engine’s message on the validation error as it is. Not a second system beside the JSON Schema — the implementation is the authority.

  • validate(string $attribute, mixed $value, Closure $fail): void

class ValidYrnkSchedules implements Illuminate\Contracts\Validation\ValidationRule

The validation rule of a schedules part. Tries the construction with ScheduleCodec (structure + references against the config environment) and puts the engine’s message on the validation error as it is. Not a second system beside the JSON Schema — the implementation is the authority.

  • validate(string $attribute, mixed $value, Closure $fail): void