This repository was archived by the owner on Jul 27, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Feat: add 4 features #13
Draft
TomKlotzPro
wants to merge
139
commits into
master
Choose a base branch
from
feat/first
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
139 commits
Select commit
Hold shift + click to select a range
3945f32
feat: add boilerplate
TomKlotzPro c2eb88d
Merge pull request #2 from algolia/feat/add-boilerplate
nunomaduro 945e661
feat: add styleci
TomKlotzPro 0e2651d
feat: add phpcs
TomKlotzPro acf20f5
fix: delete styleci config file
TomKlotzPro ee88d33
Merge pull request #3 from algolia/feat/add-styleci
nunomaduro 8d31086
feat: add phpstan config file
TomKlotzPro 7d756ff
chore: ignore *.cache files via .gitignore
TomKlotzPro 70563cb
test: add tests to check if an index exist
TomKlotzPro 67c8d3f
feat: add exist method on searchIndex class
TomKlotzPro 2453b87
style: formating and unused import
TomKlotzPro 51a283a
chore: add path to src for phpcs
TomKlotzPro 2e80e26
style: formatting code
TomKlotzPro a3b4f9e
chore: add travisCI configuration file
TomKlotzPro 369ae0a
test: delete test suite from php client and update tests
TomKlotzPro fa0c1d0
style: rename index name for test
TomKlotzPro 965935a
docs: write phpdoc for searchIndexclass and seachClient class and upd…
TomKlotzPro 9d4a373
fix: return boolean earlier
TomKlotzPro 3852e5a
chore: update travis configuration file
TomKlotzPro fa1cafc
chore: update travis configuration file, remove check for 5.3
TomKlotzPro 13507f8
docs: fixe return variable for initIndex method
TomKlotzPro 6659407
chore: update configuration of travis
TomKlotzPro 94f7a99
style: remove blank line
TomKlotzPro a955501
chore: update configuration of travis
TomKlotzPro 54e7a69
chore: update configuration of travis
TomKlotzPro 3f8305b
tests: add tearDownAfterClass method
TomKlotzPro cffeaa6
chore: phpcs configuration file change array syntax to short
TomKlotzPro bafae03
style: apply fix from phpcs
TomKlotzPro 14dcf52
chore: change composer require php version from 5.3 to 5.6
TomKlotzPro db8a811
docs: update current documentation
TomKlotzPro 2727351
docs: remove useless comment
TomKlotzPro ad27748
chore: correct autoloading in composer
TomKlotzPro bf94e0b
test: set up test suite with factory to generate index name following…
TomKlotzPro 2c521bf
fix: check boolean value should be boolean not string/boolean
TomKlotzPro 55b26dd
style: formating code and return after try catch
TomKlotzPro 1b5dfbc
chore: update configuration of travis
TomKlotzPro ce07705
fix: update key name following the CTS
TomKlotzPro 18ce770
chore: update configuration of travis
TomKlotzPro ab36251
Updates docs
nunomaduro 3bc5f5f
Merge pull request #5 from algolia/feat/index-exist
nunomaduro 5c4a6f6
chore: update configuration of travis
TomKlotzPro 1d80693
chore: update configuration of travis
TomKlotzPro e2311fa
Merge branch 'feat/first' into feat/add-travisCI
TomKlotzPro 576ef2b
style: formating style
TomKlotzPro 77f7e45
chore: update configuration of travis for phpunit
TomKlotzPro 0e0b943
chore: update configuration of travis for phpunit
TomKlotzPro 9a8f88d
chore: change configuration for phpcs to allow return type void
TomKlotzPro 5bbed70
doc: update documentation
TomKlotzPro c26ec04
chore: Change variable name for algolia credentials
TomKlotzPro 542c156
chore: update configuration of travis for phpunit
TomKlotzPro 8c17689
chore: update configuration of travis for phpunit
TomKlotzPro 05fd809
chore: update configuration of travis for phpunit
TomKlotzPro 6b8491b
chore: update configuration of travis for phpunit
TomKlotzPro c3c11df
chore: update configuration of travis for phpunit
TomKlotzPro a3f6ccf
chore: update configuration of travis for phpunit
TomKlotzPro a6c2e5a
chore: update configuration of travis for phpunit
TomKlotzPro 7f23b20
chore: update configuration of travis for phpunit
TomKlotzPro da65906
chore: update configuration of travis for phpunit
TomKlotzPro a2baaa1
chore: update composer for phpunit
TomKlotzPro 0aabdd5
chore: update composer for phpunit
TomKlotzPro 235aa76
chore: update configuration of travis for phpunit
TomKlotzPro d8c07b4
chore: update configuration of travis for phpunit
TomKlotzPro ee90b83
chore: update configuration of travis for phpunit
TomKlotzPro 2fadd72
chore: update configuration of travis for phpunit
TomKlotzPro c1cd552
chore: update configuration of travis for phpunit
TomKlotzPro c0a58fd
chore: update configuration of travis for phpunit
TomKlotzPro ea8f077
chore: update configuration of travis for phpunit
TomKlotzPro 4d9e83c
chore: update configuration of travis for phpunit
TomKlotzPro a923c24
chore: update configuration of travis for phpunit
TomKlotzPro fc8da4f
style: formating style
TomKlotzPro 52d4a0c
chore: update configuration of travis for phpunit
TomKlotzPro 0c94aa9
chore: update configuration of travis for phpunit
TomKlotzPro 2c2dad7
chore: update configuration of travis for phpunit
TomKlotzPro 0f426d1
style: formating style
TomKlotzPro f6490d8
chore: update configuration of travis for phpunit
TomKlotzPro 2ab66d8
chore: update configuration of travis for phpunit
TomKlotzPro ce1f916
chore: update configuration of travis for phpunit
TomKlotzPro d08b5b3
chore: update configuration of travis for phpunit
TomKlotzPro e77dd9f
chore: update configuration of travis for phpunit
TomKlotzPro 2de6c1f
chore: update configuration of travis for phpunit
TomKlotzPro 23bd7e8
chore: update configuration of travis for phpunit
TomKlotzPro 1505b63
chore: update configuration of travis for phpunit
TomKlotzPro 3cfbfd1
chore: update configuration of travis for phpunit
TomKlotzPro 4f6051b
chore: update configuration of travis for phpunit
TomKlotzPro bf8e6ab
test: test return value is correct with one object
TomKlotzPro 237005c
feat: add count method
TomKlotzPro 06c150b
chore: update composer to add faker to generate records
TomKlotzPro 4da1584
test: update test, generate 1000 records and check if count return 1000
TomKlotzPro 2628483
chore: add method to generate records
TomKlotzPro 46b65ab
style: formating style
TomKlotzPro 808f16c
style: formating style
TomKlotzPro 22af9d8
docs: update documentation
TomKlotzPro c33c7c2
Improves testing suite
nunomaduro f637b40
Renames ExistTest to SearchIndexTest
nunomaduro 7bd3b15
Merge feat/first
nunomaduro 7606ddb
Improves coding style
nunomaduro ac1e96e
Merge branch 'feat/first' into feat/add-phpstan
nunomaduro d118a59
Adds phpstan
nunomaduro 57ecfd9
chore: update test suite
TomKlotzPro 6375b17
chore: update test suite
TomKlotzPro b37a92c
chore: update configuration files for tests suite
TomKlotzPro 78943b1
fix: apply fix from tests suite
TomKlotzPro 1593027
chore: update composer
TomKlotzPro 6dc90b8
chore: update travis
TomKlotzPro 65fa033
docs: fix type $indexName
TomKlotzPro 04848ff
chore: update phpstan config to ignore specific error
TomKlotzPro 6c73de3
Merge pull request #4 from algolia/feat/add-phpstan
nunomaduro 9ded737
chore: add Helpers and Features directories for phpcs
TomKlotzPro fd0a58c
test: add Splitter test
TomKlotzPro 606b2bd
test: add content
TomKlotzPro 4295b60
feat: add html splitter
TomKlotzPro 6e50719
tests: add more tests
TomKlotzPro 6ed7cfb
chore:update composer
TomKlotzPro 20fbf8f
chore: update test suite, phpstan follow php 7 rules
TomKlotzPro b11a1ad
chore: update phpstan configuration
TomKlotzPro eee934e
fix: remove useless strict comparaison
TomKlotzPro e97e385
test: add multiple tests
TomKlotzPro 4a43c81
chore: phpstan only work for php7
TomKlotzPro 61d256d
test: add index name
TomKlotzPro 3b0deae
test: add index name
TomKlotzPro 887c131
test: debug index name
TomKlotzPro eb3a48f
test: change apikey / appid name
TomKlotzPro 187f942
test: change indexname and restore old api id / api key name
TomKlotzPro 277ed35
test: remove debug for index name
TomKlotzPro 385f222
chore: update travis to run phpstan
TomKlotzPro 3909141
chore: update travis to run phpstan
TomKlotzPro 701b3b0
style: rename method
TomKlotzPro e5309cb
tests: update test
TomKlotzPro 63e8724
chore: update travis to run phpstan
TomKlotzPro 123c584
chore: update travis to run phpstan
TomKlotzPro ea23330
Merge pull request #8 from algolia/feat/html-splitter
TomKlotzPro b3c96d0
Improves coding style
nunomaduro 60abd10
chore: check only branch feat/first
TomKlotzPro 9fbc408
style: improve coding style
TomKlotzPro e1aed06
Merge pull request #9 from algolia/improve/coding-style
nunomaduro 0da45d0
feat: add generate settings feature
TomKlotzPro 36a02df
Merge pull request #11 from algolia/feat/add-generate-settings
TomKlotzPro 5a9176c
fix: typo and generate settings fix
TomKlotzPro 8582e8b
Merge pull request #12 from algolia/fix/generate-settings-test
TomKlotzPro File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| *.cache | ||
| .idea/ | ||
| .php_cs.cache | ||
| /tests/cache/ | ||
| /vendor/ | ||
| composer.lock | ||
| tests/QualityTools/vendor | ||
| tests/QualityTools/composer.lock |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <?php | ||
|
|
||
| $finder = PhpCsFixer\Finder::create() | ||
| ->exclude([__DIR__.DIRECTORY_SEPARATOR.'tests/QualityTools']) | ||
| ->in(__DIR__.DIRECTORY_SEPARATOR.'tests') | ||
| ->in(__DIR__.DIRECTORY_SEPARATOR.'src') | ||
| ->append(['.php_cs.dist']); | ||
|
|
||
| $rules = [ | ||
| '@Symfony' => true, | ||
| '@PhpCsFixer' => true, | ||
| 'multiline_whitespace_before_semicolons' => true, | ||
| 'php_unit_test_class_requires_covers' => false, | ||
| 'phpdoc_no_empty_return' => false, | ||
| 'array_syntax' => ['syntax' => 'short'], | ||
| 'yoda_style' => false, | ||
| ]; | ||
|
|
||
| $rules['increment_style'] = ['style' => 'post']; | ||
|
|
||
| return PhpCsFixer\Config::create() | ||
| ->setUsingCache(true) | ||
| ->setRules($rules) | ||
| ->setFinder($finder); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| language: php | ||
|
|
||
| sudo: true | ||
|
|
||
| php: | ||
| - 5.6 | ||
| - 7.0 | ||
| - 7.1 | ||
| - 7.2 | ||
| - 7.3 | ||
| - nightly | ||
|
|
||
| env: | ||
| - COMPOSER_FLAGS="--prefer-lowest" | ||
| - COMPOSER_FLAGS="" | ||
| matrix: | ||
| allow_failures: | ||
| - php : nightly | ||
|
|
||
| before_script: | ||
| - travis_retry composer update ${COMPOSER_FLAGS} --no-interaction --prefer-source | ||
| - wget https://alg.li/algolia-keys && chmod +x algolia-keys | ||
|
|
||
| script: | ||
| - if [[$(phpenv version-name) >= "7.2" ]]; then composer install:quality-tools; fi | ||
| - if [[$(phpenv version-name) >= "7.2" ]]; then composer test:quality-tools; fi | ||
| - eval $(./algolia-keys export) | ||
| - composer test |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| # Changelog | ||
| All notable changes to this project will be documented in this file. | ||
|
|
||
| The format is based on [Keep a Changelog](http://keepachangelog.com/) | ||
| and this project adheres to [Semantic Versioning](http://semver.org/). | ||
|
|
||
| ## [Unreleased] | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| CONTRIBUTING | ||
| ============ | ||
|
|
||
|
|
||
| Contributions are welcome, and are accepted via pull requests. Please review these guidelines before submitting any pull requests. | ||
|
|
||
|
|
||
| ## Guidelines | ||
|
|
||
| * Please follow the [PSR-2 Coding Style Guide](http://www.php-fig.org/psr/psr-2/), enforced by [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer). | ||
| * Ensure that the current tests pass, and if you've added something new, add the tests where relevant. | ||
| * Send a coherent commit history, making sure each individual commit in your pull request is meaningful. | ||
| * You may need to [rebase](https://git-scm.com/book/en/v2/Git-Branching-Rebasing) to avoid merge conflicts. | ||
| * If you are changing the behavior, or the public api, you may need to update the docs. | ||
| * Please remember that we follow [SemVer](http://semver.org/). | ||
|
|
||
| We have [PHP-CS-Fixer](https://github.com/FriendsOfPHP/PHP-CS-Fixer) setup to automatically fix any code style issues. | ||
| ```bash | ||
| vendor/bin/php-cs-fixer fix | ||
| ``` | ||
|
|
||
| We have a Quality-Tools test suite setup to automatically find any potential errors. | ||
| ```bash | ||
| composer test:quality-tools | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| MIT License | ||
|
|
||
| Copyright (c) 2019-Present Algolia | ||
|
|
||
| Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| of this software and associated documentation files (the "Software"), to deal | ||
| in the Software without restriction, including without limitation the rights | ||
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| copies of the Software, and to permit persons to whom the Software is | ||
| furnished to do so, subject to the following conditions: | ||
|
|
||
| The above copyright notice and this permission notice shall be included in all | ||
| copies or substantial portions of the Software. | ||
|
|
||
| THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| SOFTWARE. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| ## `/algolia/algoliasearch-client-php-helper` maintainers | ||
|
|
||
| | Name | Email | | ||
| |-----------------|-----------------------------| | ||
| | Nuno Maduro | nuno.maduro@algolia.com | | ||
| | Tom Klotz | tom.klotz@algolia.com | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,50 @@ | ||
| { | ||
| "name": "algolia/algoliasearch-client-php-helper", | ||
| "description": "Algolia extension for search API Client", | ||
| "keywords": ["algolia", "search", "api", "client", "php", "helper"], | ||
| "type": "library", | ||
| "license": "MIT", | ||
| "authors": [ | ||
| { | ||
| "name": "Algolia Team", | ||
| "email": "contact@algolia.com" | ||
| } | ||
| ], | ||
| "require": { | ||
| "php": "^5.6 || ^7.0", | ||
| "algolia/algoliasearch-client-php": "^2.2" | ||
| }, | ||
| "suggest": { | ||
| "ext-dom": "Required to use the HTML Splitter." | ||
| }, | ||
| "require-dev": { | ||
| "friendsofphp/php-cs-fixer": "^2.15.1", | ||
| "fzaninotto/faker": "^1.8", | ||
| "phpunit/phpunit": "^5.7.27" | ||
| }, | ||
| "autoload": { | ||
| "psr-4": { | ||
| "Algolia\\AlgoliaSearch\\Helper\\": "src/" | ||
| } | ||
| }, | ||
| "autoload-dev": { | ||
| "psr-4": { | ||
| "Algolia\\AlgoliaSearch\\Helper\\Tests\\": "tests/" | ||
| } | ||
| }, | ||
| "scripts": { | ||
TomKlotzPro marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "install:quality-tools": "composer update -d tests/QualityTools/", | ||
| "phpstan": "tests/QualityTools/vendor/bin/phpstan analyse --ansi", | ||
| "phpinsights": "tests/QualityTools/vendor/bin/phpinsights analyse --ansi --min-quality=88.3 --min-complexity=58.7 --min-architecture=95.2 --min-style=91.3", | ||
| "phpunit": "phpunit --colors=always", | ||
| "php-cs-fixer": "php-cs-fixer fix -v --dry-run", | ||
| "test:quality-tools": [ | ||
| "@phpstan", | ||
| "@phpinsights" | ||
| ], | ||
| "test": [ | ||
| "@php-cs-fixer", | ||
| "@phpunit" | ||
| ] | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| includes: | ||
| - tests/QualityTools/vendor/phpstan/phpstan-strict-rules/rules.neon | ||
| - tests/QualityTools/vendor/localheinz/phpstan-rules/rules.neon | ||
| - tests/QualityTools/vendor/thecodingmachine/phpstan-strict-rules/phpstan-strict-rules.neon | ||
| - tests/QualityTools/vendor/roave/no-floaters/rules.neon | ||
|
|
||
| parameters: | ||
| level: max | ||
| paths: | ||
| - src | ||
| - tests/Integration | ||
| ignoreErrors: | ||
| - '#return type can be added. More info#' | ||
| - '#Parameter \#1 \$indexName \(string\) of method Algolia\\AlgoliaSearch\\Helper\\SearchClient::initIndex\(\) should be contravariant with parameter \$indexName \(mixed\) of method Algolia\\AlgoliaSearch\\SearchClient::initIndex\(\)#' | ||
| - '#In method.*type-hinted.*More info#' | ||
| - '#In method \"Algolia\\AlgoliaSearch\\Helper\\Splitters\\HtmlSplitter::split\", caught \"Exception\" must be rethrown. Either catch a more specific exception or add a \"throw\" clause in the \"catch\" block to propagate the exception.#' | ||
| - '#Method.*has parameter \$tags with null as default value.#' | ||
| - '#Constructor.*has parameter \$tags with default value.#' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <phpunit colors="true" bootstrap="tests/bootstrap.php"> | ||
| <ini name="date.timezone" value="UTC"/> | ||
| <testsuite> | ||
| <testsuite name="Integration"> | ||
| <directory suffix="Test.php">tests/Integration/</directory> | ||
| </testsuite> | ||
| </testsuite> | ||
| </phpunit> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * This file is part of AlgoliaSearch Client PHP Helper. | ||
| * | ||
| * (c) Algolia Team <contact@algolia.com> | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| */ | ||
|
|
||
| namespace Algolia\AlgoliaSearch\Helper\Contracts; | ||
|
|
||
| /** | ||
| * @internal | ||
| */ | ||
| interface SettingContract | ||
| { | ||
| /** | ||
| * Checks if the given key/value is a setting. | ||
| * | ||
| * @param int|string $key | ||
| * @param null|array<int, string>|object|string $value | ||
| * @param array<int, string> $detectedSettings | ||
| * | ||
| * @return array<int, int|string> | ||
| */ | ||
| public function getDetectedSettings($key, $value, $detectedSettings); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * This file is part of AlgoliaSearch Client PHP Helper. | ||
| * | ||
| * (c) Algolia Team <contact@algolia.com> | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| */ | ||
|
|
||
| namespace Algolia\AlgoliaSearch\Helper\Contracts; | ||
|
|
||
| interface SplitterContract | ||
| { | ||
| /** | ||
| * Splits the given value. | ||
| * | ||
| * @param string $value | ||
| * | ||
| * @return array<int, array> | ||
| */ | ||
| public function split($value); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * This file is part of Laravel. | ||
| * | ||
| * https://github.com/laravel/framework/blob/master/src/Illuminate/Support/Str.php | ||
| * | ||
| * It was modified by Algolia Team <contact@algolia.com> | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| */ | ||
|
|
||
| namespace Algolia\AlgoliaSearch\Helper\Helpers; | ||
|
|
||
| /** | ||
| * @internal | ||
| */ | ||
| final class Str | ||
| { | ||
| /** | ||
| * Determine if a given string matches a given pattern. | ||
| * | ||
| * @param array<int, string>|string $pattern | ||
| * @param null|int|string $value | ||
| * | ||
| * @return bool | ||
| */ | ||
| public static function is($pattern, $value) | ||
| { | ||
| $patterns = is_array($pattern) ? $pattern : (array) $pattern; | ||
|
|
||
| if (null === $value || 0 === count($patterns)) { | ||
| return false; | ||
| } | ||
| foreach ($patterns as $patternValue) { | ||
| if ($patternValue === $value) { | ||
| return true; | ||
| } | ||
| $patternValue = preg_quote($patternValue, '#'); | ||
| $patternValue = str_replace('\*', '.*', $patternValue); | ||
| if (1 === preg_match('#^'.$patternValue.'\z#u', (string) $value)) { | ||
| return true; | ||
| } | ||
| } | ||
|
|
||
| return false; | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * This file is part of AlgoliaSearch Client PHP Helper. | ||
| * | ||
| * (c) Algolia Team <contact@algolia.com> | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| */ | ||
|
|
||
| namespace Algolia\AlgoliaSearch\Helper; | ||
|
|
||
| final class SearchClient extends \Algolia\AlgoliaSearch\SearchClient | ||
| { | ||
| /** | ||
| * Creates a new instance of the Search Client. | ||
| * | ||
| * @param string $indexName | ||
| * | ||
| * @return \Algolia\AlgoliaSearch\Helper\SearchIndex | ||
| */ | ||
| public function initIndex($indexName) | ||
| { | ||
| return new SearchIndex($indexName, $this->api, $this->config); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,27 @@ | ||
| <?php | ||
|
|
||
| /** | ||
| * This file is part of AlgoliaSearch Client PHP Helper. | ||
| * | ||
| * (c) Algolia Team <contact@algolia.com> | ||
| * | ||
| * For the full copyright and license information, please view the LICENSE | ||
| * file that was distributed with this source code. | ||
| */ | ||
|
|
||
| namespace Algolia\AlgoliaSearch\Helper; | ||
|
|
||
| final class SearchIndex extends \Algolia\AlgoliaSearch\SearchIndex | ||
| { | ||
| /** | ||
| * Count number of records of the index. | ||
| * | ||
| * @return int | ||
| */ | ||
| public function count() | ||
| { | ||
| $response = $this->search(''); | ||
|
|
||
| return $response['nbHits']; | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.