Skip to content

Commit eb993ab

Browse files
author
Brian Faust
committed
refactor: rename create to new (ruby like syntax)
1 parent 51e0165 commit eb993ab

File tree

12 files changed

+16
-16
lines changed

12 files changed

+16
-16
lines changed

src/Builder/AbstractTransaction.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __toString()
6767
*
6868
* @return \ArkEcosystem\Crypto\Builder\AbstractTransaction
6969
*/
70-
public static function create(): self
70+
public static function new(): self
7171
{
7272
return new static();
7373
}

src/Configuration/Network.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public static function __callStatic(string $method, array $args)
5050
*/
5151
public static function get(): AbstractNetwork
5252
{
53-
return static::$network ?? Mainnet::create();
53+
return static::$network ?? Mainnet::new();
5454
}
5555

5656
/**

tests/Builder/DelegateRegistrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class DelegateRegistrationTest extends TestCase
2828
/** @test */
2929
public function it_should_create_a_valid_transaction()
3030
{
31-
$transaction = DelegateRegistration::create()
31+
$transaction = DelegateRegistration::new()
3232
->username('polopolo')
3333
->sign('This is a top secret passphrase');
3434

tests/Builder/MultiSignatureRegistrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class MultiSignatureRegistrationTest extends TestCase
2828
/** @test */
2929
public function it_should_create_a_valid_transaction()
3030
{
31-
$transaction = MultiSignatureRegistration::create()
31+
$transaction = MultiSignatureRegistration::new()
3232
->min(2)
3333
->lifetime(255)
3434
->keysgroup([

tests/Builder/SecondSignatureRegistrationTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class SecondSignatureRegistrationTest extends TestCase
2929
/** @test */
3030
public function it_should_create_a_valid_transaction()
3131
{
32-
$transaction = SecondSignatureRegistration::create()
32+
$transaction = SecondSignatureRegistration::new()
3333
->signature('second passphrase')
3434
->sign('first passphrase');
3535

tests/Builder/TransferTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class TransferTest extends TestCase
2828
/** @test */
2929
public function it_should_create_a_valid_transaction()
3030
{
31-
$transaction = Transfer::create()
31+
$transaction = Transfer::new()
3232
->recipient('AXoXnFi4z1Z6aFvjEYkDVCtBGW2PaRiM25')
3333
->amount(133380000000)
3434
->vendorField('This is a transaction from PHP')
@@ -43,7 +43,7 @@ public function it_should_create_a_valid_transaction_using_a_second_secret()
4343
{
4444
$secondSecret = 'this is a top secret second passphrase';
4545

46-
$transaction = Transfer::create()
46+
$transaction = Transfer::new()
4747
->recipient('AXoXnFi4z1Z6aFvjEYkDVCtBGW2PaRiM25')
4848
->amount(133380000000)
4949
->vendorField('This is a transaction from PHP')

tests/Builder/VoteTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class VoteTest extends TestCase
2828
/** @test */
2929
public function it_should_create_a_valid_transaction()
3030
{
31-
$transaction = Vote::create()
31+
$transaction = Vote::new()
3232
->votes(['+034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed192'])
3333
->sign('This is a top secret passphrase');
3434

tests/Configuration/NetworkTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function it_should_set_the_network()
4040
$actual = Network::get();
4141
$this->assertInstanceOf(Mainnet::class, $actual);
4242

43-
Network::set(Devnet::create());
43+
Network::set(Devnet::new());
4444

4545
$actual = Network::get();
4646
$this->assertInstanceOf(Devnet::class, $actual);

tests/Identity/AddressTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class AddressTest extends TestCase
2929
/** @test */
3030
public function it_should_get_the_address_from_public_key()
3131
{
32-
$actual = TestClass::fromPublicKey('034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed192', Devnet::create());
32+
$actual = TestClass::fromPublicKey('034151a3ec46b5670a682b0a63394f863587d1bc97483b1b6c70eb58e7f0aed192', Devnet::new());
3333

3434
$this->assertInternalType('string', $actual);
3535
$this->assertSame('D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib', $actual);
@@ -38,7 +38,7 @@ public function it_should_get_the_address_from_public_key()
3838
/** @test */
3939
public function it_should_get_the_address_from_secret()
4040
{
41-
$actual = TestClass::fromSecret('this is a top secret passphrase', Devnet::create());
41+
$actual = TestClass::fromSecret('this is a top secret passphrase', Devnet::new());
4242

4343
$this->assertInternalType('string', $actual);
4444
$this->assertSame('D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib', $actual);
@@ -49,7 +49,7 @@ public function it_should_get_the_address_from_private_key()
4949
{
5050
$privateKey = PrivateKey::fromSecret('this is a top secret passphrase');
5151

52-
$actual = TestClass::fromPrivateKey($privateKey, Devnet::create());
52+
$actual = TestClass::fromPrivateKey($privateKey, Devnet::new());
5353

5454
$this->assertInternalType('string', $actual);
5555
$this->assertSame('D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib', $actual);
@@ -58,7 +58,7 @@ public function it_should_get_the_address_from_private_key()
5858
/** @test */
5959
public function it_should_validate_the_address()
6060
{
61-
$actual = TestClass::validate('D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib', Devnet::create());
61+
$actual = TestClass::validate('D61mfSggzbvQgTUe6JhYKH2doHaqJ3Dyib', Devnet::new());
6262

6363
$this->assertInternalType('boolean', $actual);
6464
$this->assertTrue($actual);

tests/Identity/PrivateKeyTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class PrivateKeyTest extends TestCase
2929
/** @test */
3030
public function it_should_get_the_private_key_from_secret()
3131
{
32-
$actual = TestClass::fromSecret('this is a top secret passphrase', Devnet::create());
32+
$actual = TestClass::fromSecret('this is a top secret passphrase', Devnet::new());
3333

3434
$this->assertInstanceOf(EcPublicKey::class, $actual);
3535
$this->assertInternalType('string', $actual->getHex());

0 commit comments

Comments
 (0)