public function encrypt(Encryptable $model): EncryptionService
    {
        if ($model->getEncrypted()) {
            return $this;
        }

        $properties = $this->getProperties($model);

        foreach ($properties as $property) {
            $property->setAccessible(true);
            $property->setValue($model, $this->cipherService->encrypt($property->getValue($model)));
        }

        $model->setEncrypted(true);

        return $this;
    }
public function encrypt(Encryptable $model): EncryptionService
    {
        if ($model->getEncrypted()) {
            return $this;
        }

        $properties = $this->getProperties($model);

        foreach ($properties as $property) {
            $property->setAccessible(true);
            $property->setValue($model, $this->cipherService->encrypt($property->getValue($model)));
        }

        $model->setEncrypted(true);

        return $this;
    }
public function encrypt ( Encryptable $ model ) : EncryptionService { if ( $ model -> getEncrypted ( ) ) { return $ this ; } $ properties = $ this -> getProperties ( $ model ) ; foreach ( $ properties as $ property ) { $ property -> setAccessible ( true ) ; $ property -> setValue ( $ model , $ this -> cipherService -> encrypt ( $ property -> getValue ( $ model ) ) ) ; } $ model -> setEncrypted ( true ) ; return $ this ; }
Encrypt model using secret key

@param \Ds\Component\Encryption\Model\Type\Encryptable $model
@return \Ds\Component\Encryption\Service\EncryptionService
Encrypt model using secret key