Skip to content
This repository was archived by the owner on Jul 27, 2020. It is now read-only.
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
3945f32
feat: add boilerplate
TomKlotzPro May 20, 2019
c2eb88d
Merge pull request #2 from algolia/feat/add-boilerplate
nunomaduro May 20, 2019
945e661
feat: add styleci
TomKlotzPro May 20, 2019
0e2651d
feat: add phpcs
TomKlotzPro May 20, 2019
acf20f5
fix: delete styleci config file
TomKlotzPro May 20, 2019
ee88d33
Merge pull request #3 from algolia/feat/add-styleci
nunomaduro May 20, 2019
8d31086
feat: add phpstan config file
TomKlotzPro May 21, 2019
7d756ff
chore: ignore *.cache files via .gitignore
TomKlotzPro May 21, 2019
70563cb
test: add tests to check if an index exist
TomKlotzPro May 21, 2019
67c8d3f
feat: add exist method on searchIndex class
TomKlotzPro May 21, 2019
2453b87
style: formating and unused import
TomKlotzPro May 21, 2019
51a283a
chore: add path to src for phpcs
TomKlotzPro May 21, 2019
2e80e26
style: formatting code
TomKlotzPro May 21, 2019
a3b4f9e
chore: add travisCI configuration file
TomKlotzPro May 27, 2019
369ae0a
test: delete test suite from php client and update tests
TomKlotzPro May 27, 2019
fa0c1d0
style: rename index name for test
TomKlotzPro May 27, 2019
965935a
docs: write phpdoc for searchIndexclass and seachClient class and upd…
TomKlotzPro May 27, 2019
9d4a373
fix: return boolean earlier
TomKlotzPro May 27, 2019
3852e5a
chore: update travis configuration file
TomKlotzPro May 27, 2019
fa1cafc
chore: update travis configuration file, remove check for 5.3
TomKlotzPro May 27, 2019
13507f8
docs: fixe return variable for initIndex method
TomKlotzPro May 28, 2019
6659407
chore: update configuration of travis
TomKlotzPro May 28, 2019
94f7a99
style: remove blank line
TomKlotzPro May 28, 2019
a955501
chore: update configuration of travis
TomKlotzPro May 28, 2019
54e7a69
chore: update configuration of travis
TomKlotzPro May 28, 2019
3f8305b
tests: add tearDownAfterClass method
TomKlotzPro May 28, 2019
cffeaa6
chore: phpcs configuration file change array syntax to short
TomKlotzPro May 28, 2019
bafae03
style: apply fix from phpcs
TomKlotzPro May 28, 2019
14dcf52
chore: change composer require php version from 5.3 to 5.6
TomKlotzPro May 28, 2019
db8a811
docs: update current documentation
TomKlotzPro May 28, 2019
2727351
docs: remove useless comment
TomKlotzPro May 28, 2019
ad27748
chore: correct autoloading in composer
TomKlotzPro May 31, 2019
bf94e0b
test: set up test suite with factory to generate index name following…
TomKlotzPro May 31, 2019
2c521bf
fix: check boolean value should be boolean not string/boolean
TomKlotzPro May 31, 2019
55b26dd
style: formating code and return after try catch
TomKlotzPro May 31, 2019
1b5dfbc
chore: update configuration of travis
TomKlotzPro May 31, 2019
ce07705
fix: update key name following the CTS
TomKlotzPro May 31, 2019
18ce770
chore: update configuration of travis
TomKlotzPro May 31, 2019
ab36251
Updates docs
nunomaduro May 31, 2019
3bc5f5f
Merge pull request #5 from algolia/feat/index-exist
nunomaduro May 31, 2019
5c4a6f6
chore: update configuration of travis
TomKlotzPro May 31, 2019
1d80693
chore: update configuration of travis
TomKlotzPro May 31, 2019
e2311fa
Merge branch 'feat/first' into feat/add-travisCI
TomKlotzPro May 31, 2019
576ef2b
style: formating style
TomKlotzPro May 31, 2019
77f7e45
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
0e0b943
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
9a8f88d
chore: change configuration for phpcs to allow return type void
TomKlotzPro May 31, 2019
5bbed70
doc: update documentation
TomKlotzPro May 31, 2019
c26ec04
chore: Change variable name for algolia credentials
TomKlotzPro May 31, 2019
542c156
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
8c17689
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
05fd809
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
6b8491b
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
c3c11df
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
a3f6ccf
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
a6c2e5a
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
7f23b20
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
da65906
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
a2baaa1
chore: update composer for phpunit
TomKlotzPro May 31, 2019
0aabdd5
chore: update composer for phpunit
TomKlotzPro May 31, 2019
235aa76
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
d8c07b4
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
ee90b83
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
2fadd72
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
c1cd552
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
c0a58fd
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
ea8f077
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
4d9e83c
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
a923c24
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
fc8da4f
style: formating style
TomKlotzPro May 31, 2019
52d4a0c
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
0c94aa9
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
2c2dad7
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
0f426d1
style: formating style
TomKlotzPro May 31, 2019
f6490d8
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
2ab66d8
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
ce1f916
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
d08b5b3
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
e77dd9f
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
2de6c1f
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
23bd7e8
chore: update configuration of travis for phpunit
TomKlotzPro May 31, 2019
1505b63
chore: update configuration of travis for phpunit
TomKlotzPro Jun 3, 2019
3cfbfd1
chore: update configuration of travis for phpunit
TomKlotzPro Jun 3, 2019
4f6051b
chore: update configuration of travis for phpunit
TomKlotzPro Jun 3, 2019
bf8e6ab
test: test return value is correct with one object
TomKlotzPro Jun 3, 2019
237005c
feat: add count method
TomKlotzPro Jun 3, 2019
06c150b
chore: update composer to add faker to generate records
TomKlotzPro Jun 3, 2019
4da1584
test: update test, generate 1000 records and check if count return 1000
TomKlotzPro Jun 3, 2019
2628483
chore: add method to generate records
TomKlotzPro Jun 3, 2019
46b65ab
style: formating style
TomKlotzPro Jun 3, 2019
808f16c
style: formating style
TomKlotzPro Jun 3, 2019
22af9d8
docs: update documentation
TomKlotzPro Jun 3, 2019
c33c7c2
Improves testing suite
nunomaduro Jun 3, 2019
f637b40
Renames ExistTest to SearchIndexTest
nunomaduro Jun 3, 2019
7bd3b15
Merge feat/first
nunomaduro Jun 3, 2019
7606ddb
Improves coding style
nunomaduro Jun 3, 2019
ac1e96e
Merge branch 'feat/first' into feat/add-phpstan
nunomaduro Jun 3, 2019
d118a59
Adds phpstan
nunomaduro Jun 3, 2019
57ecfd9
chore: update test suite
TomKlotzPro Jun 3, 2019
6375b17
chore: update test suite
TomKlotzPro Jun 3, 2019
b37a92c
chore: update configuration files for tests suite
TomKlotzPro Jun 3, 2019
78943b1
fix: apply fix from tests suite
TomKlotzPro Jun 3, 2019
1593027
chore: update composer
TomKlotzPro Jun 3, 2019
6dc90b8
chore: update travis
TomKlotzPro Jun 4, 2019
65fa033
docs: fix type $indexName
TomKlotzPro Jun 4, 2019
04848ff
chore: update phpstan config to ignore specific error
TomKlotzPro Jun 4, 2019
6c73de3
Merge pull request #4 from algolia/feat/add-phpstan
nunomaduro Jun 4, 2019
9ded737
chore: add Helpers and Features directories for phpcs
TomKlotzPro Jun 4, 2019
fd0a58c
test: add Splitter test
TomKlotzPro Jun 4, 2019
606b2bd
test: add content
TomKlotzPro Jun 4, 2019
4295b60
feat: add html splitter
TomKlotzPro Jun 4, 2019
6e50719
tests: add more tests
TomKlotzPro Jun 4, 2019
6ed7cfb
chore:update composer
TomKlotzPro Jun 4, 2019
20fbf8f
chore: update test suite, phpstan follow php 7 rules
TomKlotzPro Jun 4, 2019
b11a1ad
chore: update phpstan configuration
TomKlotzPro Jun 5, 2019
eee934e
fix: remove useless strict comparaison
TomKlotzPro Jun 5, 2019
e97e385
test: add multiple tests
TomKlotzPro Jun 5, 2019
4a43c81
chore: phpstan only work for php7
TomKlotzPro Jun 5, 2019
61d256d
test: add index name
TomKlotzPro Jun 5, 2019
3b0deae
test: add index name
TomKlotzPro Jun 5, 2019
887c131
test: debug index name
TomKlotzPro Jun 6, 2019
eb3a48f
test: change apikey / appid name
TomKlotzPro Jun 6, 2019
187f942
test: change indexname and restore old api id / api key name
TomKlotzPro Jun 6, 2019
277ed35
test: remove debug for index name
TomKlotzPro Jun 6, 2019
385f222
chore: update travis to run phpstan
TomKlotzPro Jun 11, 2019
3909141
chore: update travis to run phpstan
TomKlotzPro Jun 11, 2019
701b3b0
style: rename method
TomKlotzPro Jun 11, 2019
e5309cb
tests: update test
TomKlotzPro Jun 11, 2019
63e8724
chore: update travis to run phpstan
TomKlotzPro Jun 11, 2019
123c584
chore: update travis to run phpstan
TomKlotzPro Jun 11, 2019
ea23330
Merge pull request #8 from algolia/feat/html-splitter
TomKlotzPro Jun 11, 2019
b3c96d0
Improves coding style
nunomaduro Jun 19, 2019
60abd10
chore: check only branch feat/first
TomKlotzPro Jun 19, 2019
9fbc408
style: improve coding style
TomKlotzPro Jun 20, 2019
e1aed06
Merge pull request #9 from algolia/improve/coding-style
nunomaduro Jun 20, 2019
0da45d0
feat: add generate settings feature
TomKlotzPro Jun 24, 2019
36a02df
Merge pull request #11 from algolia/feat/add-generate-settings
TomKlotzPro Jun 27, 2019
5a9176c
fix: typo and generate settings fix
TomKlotzPro Jun 27, 2019
8582e8b
Merge pull request #12 from algolia/fix/generate-settings-test
TomKlotzPro Jun 27, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
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
24 changes: 24 additions & 0 deletions .php_cs.dist
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);
28 changes: 28 additions & 0 deletions .travis.yml
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
8 changes: 8 additions & 0 deletions CHANGELOG.md
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]

25 changes: 25 additions & 0 deletions CONTRIBUTING.md
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
```
21 changes: 21 additions & 0 deletions LICENCE
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.
6 changes: 6 additions & 0 deletions MAINTAINERS.md
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 |
50 changes: 50 additions & 0 deletions composer.json
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": {
"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"
]
}
}
18 changes: 18 additions & 0 deletions phpstan.neon.dist
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.#'
9 changes: 9 additions & 0 deletions phpunit.xml.dist
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>
29 changes: 29 additions & 0 deletions src/Contracts/SettingContract.php
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);
}
24 changes: 24 additions & 0 deletions src/Contracts/SplitterContract.php
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);
}
49 changes: 49 additions & 0 deletions src/Helpers/Str.php
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;
}
}
27 changes: 27 additions & 0 deletions src/SearchClient.php
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);
}
}
27 changes: 27 additions & 0 deletions src/SearchIndex.php
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'];
}
}
Loading