Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getter for from, to task's parameters #59

Closed
lucatacconi opened this issue Sep 19, 2023 · 1 comment
Closed

Getter for from, to task's parameters #59

lucatacconi opened this issue Sep 19, 2023 · 1 comment
Milestone

Comments

@lucatacconi
Copy link
Contributor

In the Event.php class there are some public variables of the class and some public methods such as getExpression(), getId() which are very useful if you integrate the class and want to have details on the task you want to analyze.

Unfortunately there is no way to determine if the task has a lifetime configured by "from", "to" or "between" method.
Could be useful to have some getters for "from" and "to" configurations or have public variables to read that.

Theoretically the change could be quite simple.

You can add the variable "from" and "to" to the top of Event.php file with something like that:

/**
* Lifetime from.
*
* @var \DateTime|string
*/
public $from;

/**
* Lifetime to.
*
* @var \DateTime|string
*/
public $to;

and then modify class method from and to at line 448 and 460 with something like that:

/**
* Check if event should be on.
*
* @param string $datetime
*
* @return self
*/
public function from($datetime)
{
    $this->from = $datetime;
    return $this->skip(fn () => $this->notYet($datetime));
}

/**
* Check if event should be off.
*
* @param string $datetime
*
* @return self
*/
public function to($datetime)
{
    $this->to = $datetime;
    return $this->skip(fn () => $this->past($datetime));
}
@PabloKowalczyk
Copy link
Member

Fixed by #68

@PabloKowalczyk PabloKowalczyk added this to the v3.6 milestone Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants