PHP code example of dszczer / oscillator

1. Go to this page and download the library: Download dszczer/oscillator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

dszczer / oscillator example snippets


declare(strict_types=1);

namespace Dszczer\Oscillator;

use Dszczer\Oscillator\BistableOscillatorInterface;

final class BistableOscillator implements BistableOscillatorInterface
{
    private $oscillatorState = false;

    /**
     * @inheritDoc
     */
    public function getOscillatorState(): bool
    {
        return $this->oscillatorState;
    }

    /**
     * @inheritDoc
     */
    public function tick(): void
    {
        $this->oscillatorState = !$this->oscillatorState;
    }
}