I've taken the stance before against pulling code into a method just to make a longer one look shorter.
So you'd think my AppServiceProvider would be a straight line of code. It isn't.
public function boot(): void
{
$this->bootBladeDirectives();
$this->bootModelStrictness();
$this->bootMacros();
$this->bootViewComposers();
}
public function register(): void
{
$this->registerStripe();
$this->registerLocalServiceStubs();
}
Every one of those is private and called exactly once. By my own rule, this should upset me, but it doesn't.
The difference is that these are actually independent.
bootBladeDirectives() doesn't need bootMacros() to have run first.
I could reorder the calls and nothing would break.
Each is its own complete job that happens to live next to its siblings.
Each of these methods has everything a small class would, minus the extra file to open and wire up.
Here to help,
Aaron
P.S. My rules come with exceptions, and debating where the line sits is half the fun. Come argue the other side in our community.