/** * Make the connection instance. * * @param array $config * * @throws \InvalidArgumentException * * @return mixed */ public function createConnection(array $config) { $method = 'create' . Str::studly($config['name']) . 'Connection'; if (isset($this->extensions[$config['name']])) { return $this->callCustomCreator($config['name'], $config); } elseif (method_exists($this, $method)) { return $this->{$method}($config); } throw new InvalidArgumentException(sprintf('Connection [%s] not supported.', $config['name'])); }
public function testStudlyCase() { //StudlyCase <=> PascalCase $this->assertEquals('FooBar', Str::studly('Foo Bar')); $this->assertEquals('FooBar', Str::studly('foo bar')); $this->assertEquals('FooBar', Str::studly('FooBar')); $this->assertEquals('FooBar', Str::studly('fooBar')); $this->assertEquals('FooBar', Str::studly('foo-bar')); $this->assertEquals('FooBar', Str::studly('foo_bar')); $this->assertEquals('FooBar', Str::studly('FOO_BAR')); $this->assertEquals('FooBar', Str::studly('foo_bar')); $this->assertEquals('FooBar', Str::studly('foo_bar')); // test cache $this->assertEquals('FooBarBaz', Str::studly('foo-barBaz')); $this->assertEquals('FooBarBaz', Str::studly('foo-bar_baz')); }