定制 germania-kg/vatidno 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

germania-kg/vatidno

Composer 安装命令:

composer require germania-kg/vatidno

包简介

Interfaces and traits for VAT ID numbers.

README 文档

README

Interfaces, traits, and filters for dealing with VAT ID numbers

Packagist PHP version Tests

Installation

$ composer require germania-kg/vatidno

Interfaces

VatIdNoProviderInterface

Provides a method VatIdNo to retrieve the VATIN as string.

use Germania\VatIdNo\VatIdNoProviderInterface;

/**	
 * @return string
 */
public function getVatIdNo();

VatIdNoAwareInterface

Extends VatIdNoProviderInterface and provides a method setVatIdNo, allowing you to set the VATIN.

use Germania\VatIdNo\VatIdNoProviderInterface;

/**	
 * @param  string $vatin
 * @return self
 */
public function setVatIdNo( $vatin );
public function getVatIdNo();

Traits

VatIdNoProviderTrait

Implements the VatIdNoProviderInterface and provides a public property vatin:

use Germania\VatIdNo\VatIdNoProviderInterface;
use Germania\VatIdNo\VatIdNoProviderTrait;

class MyClass implements VatIdNoProviderInterface {

	use VatIdNoProviderTrait;
	
	public function __construct( $vatin ) {
		$this->vatin = $vatin;
	}
}

VatIdNoAwareTrait

Implements the VatIdNoAwareInterface. Utilizes the VatIdNoProviderTrait.

use Germania\VatIdNo\VatIdNoAwareInterface;
use Germania\VatIdNo\VatIdNoAwareTrait;

class MyClass implements VatIdNoAwareInterface {
	use VatIdNoAwareTrait;
}

// Simple example
$object1 = new MyClass;
$object1->setVatIdNo( "XY000000" );

// Fluent interface
echo $object1->setVatIdNo( "XY000000" )->vatin;

// Setting using VatIdNoProviderInterface
$object2 = new MyClass;
$object2->setVatIdNo( $object1 );

Filters

WithVatIdNoFilterIterator

Filter for records that do provide a VATIN. These may be:

  • Arrays with vatin key, and non-empty value
  • Objects with vatin property, and non-empty value
  • Instances of VatIdNoProviderInterface where getVatIdNo results not empty
<?php
use Germania\VatIdNo\Filters\WithVatIdNoFilterIterator;

$records = new \ArrayIterator( ask_database() );

// Allow custom field names in arrays or objects
$records_with_vatin = new WithoutVatIdNoFilterIterator( $records );
$records_with_vatin = new WithoutVatIdNoFilterIterator( $records, "ust_id" );

foreach( $records_with_vatin as $item):
 // Do things like validating
endforeach;

WithoutVatIdNoFilterIterator

Filter for records that do not provide a VATIN. These may be:

  • Arrays lacking vatin key, or empty vatin element
  • Objects lacking vatin property, or empty vatin property
  • Instances of VatIdNoProviderInterface where getVatIdNo results empty
<?php
use Germania\VatIdNo\Filters\WithoutVatIdNoFilterIterator;

$records = new \ArrayIterator( ask_database() );

// Allow custom field names in arrays or objects
$records_lacking = new WithoutVatIdNoFilterIterator( $records );
$records_lacking = new WithoutVatIdNoFilterIterator( $records, "ust_id" );

foreach( $records_lacking as item):
 //...
endforeach;

Validation

To validate the VAT ID numbers, use a dedicated package like David de Boer's ddeboer/vatin package.

Development

$ git clone https://github.com/GermaniaKG/VatIdNo.git
$ cd VatIdNo
$ composer install

Unit tests

Either copy phpunit.xml.dist to phpunit.xml and adapt to your needs, or leave as is. Run PhpUnit test or composer scripts like this:

$ composer test
# or
$ vendor/bin/phpunit

统计信息

  • 总下载量: 103
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 6
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 2
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: proprietary
  • 更新时间: 2018-04-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固