This code has me excited. Most XenWord classes reuse the same code for calling the options in WordPress database.
PHP:
class Post {
protected $options;
/**
* Post constructor.
*/
public function __construct() {
$this->options = get_option( 'xenword_options' );
}
Traits were introduced in PHP 5.4 and so repetitive code can be moved into a trait and called with the use statement. The following video shows the replacement of the above code with use Options.
It's a great way to speed up coding. In the future, new options can also be added to the trait file.