Skip to content

Some criticism of this package #30

@uuf6429

Description

@uuf6429

First of all, apologies to disregard the template. I'd like to get straight to the point on a few issues.

  1. Expired records are not excluded by default, which isn't expected behaviour and causes end users to hack up their own way (this should be done in the apply method of the scope class).
  2. Regarding setExpiresAtAttribute:
    1. Setting the value of expires_at is very weird - there's a lot of funny parsing going on when instead it should have been a simple is_int($x) ? Carbon::now()->addSeconds($x) : $x - the current code somehow doesn't work for me in a simple test with timestamps and Carbon::setTestNow()
    2. If the dev named the column something else the setExpiresAtAttribute code will not be triggered for the other column name - this could be confusing/misleading
  3. Regarding the Expirable trait:
    1. It is missing method PHPDoc (it should document the macros from ExpiringScope).
    2. Instead of redeclaring @property $attributes and @property $dates in that trait, maybe use @mixin HasAttributes instead.
    3. Careful that even if getSeconds trait method is protected, it could come down to some nasty incompatibility with other traits or implementing class. Same situation with importing all the methods from InteractsWithTime trait.
  4. I'd consider better names for the macros, for example Subscription::withoutExpiration is more idiomatic than notExpiring.

On a different perspective, there's a competing package that solves some issues above but has its own problems.
Maybe consider partnering up to bring the best of both?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions