---
title: Reference
description: The public classes, interfaces and enums of yarunoka/laravel, generated from their docblocks.
sidebar:
  order: 2
---

<!-- Generated by `composer docs:generate`. Edit the docblocks in src/, not this file. -->

## Yarunoka\Laravel

### Schedule

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

The wrapper the cast answers a schedules-part column with. The core's YrnkSchedule is one OR branch and the judgment API is per branch, so the any-composition a column (a whole schedules part — a list of branches) needs is closed inside this class. 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`).

#### Properties

- `array $schedules`

#### Methods

- `__construct(array $schedules)`
- `isDue(DateTimeInterface $at, DateTimeInterface $since): bool` — Is there a scheduled point of any branch in the half-open interval (since, at] — the firing decision. Asks YrnkEvaluator's hasMatchIn per branch and composes with any.
- `toArray(): array` — The raw form of the DSL (list<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.

### YarunokaServiceProvider

`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.

#### Methods

- `register(): void`
- `boot(): void`

## Yarunoka\Laravel\Casts

### AsYrnk

`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.

#### Methods

- `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).

### AsYrnkSchedules

`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<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).

#### Methods

- `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).

## Yarunoka\Laravel\Exceptions

### InvalidYrnkColumnException

`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.

## Yarunoka\Laravel\Rules

### ValidYrnk

`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.

#### Methods

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

### ValidYrnkSchedules

`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.

#### Methods

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