├── .gitignore ├── .scrutinizer.yml ├── .travis.yml ├── LICENSE ├── composer.json ├── composer.lock ├── phpunit.xml.dist ├── readme.md ├── src └── JamesMoss │ └── Flywheel │ ├── CachedQuery.php │ ├── Config.php │ ├── Document.php │ ├── DocumentInterface.php │ ├── Formatter │ ├── FormatInterface.php │ ├── JSON.php │ ├── Markdown.php │ └── YAML.php │ ├── NestedRepository.php │ ├── Predicate.php │ ├── Query.php │ ├── QueryExecuter.php │ ├── Repository.php │ └── Result.php └── test └── JamesMoss └── Flywheel ├── CachedQueryTest.php ├── ConfigTest.php ├── DocumentTest.php ├── Formatter ├── JSONTest.php ├── MarkdownTest.php ├── YAMLTest.php └── fixtures │ ├── joe.md │ └── joe.yaml ├── NestedRepositoryTest.php ├── PredicateTest.php ├── QueryExecuterTest.php ├── QueryTest.php ├── RepositoryTest.php ├── ResultTest.php ├── TestBase.php └── fixtures └── datastore ├── notwritable └── .gitkeep ├── querytest ├── baddata │ ├── Denmark_89da124e04dfe1ad9946cd37d91a119e1d028898.json │ └── Djibouti_60a8b0c6de6f6abe5999959a5c7352750116fb9c.json ├── countries │ ├── Afghanistan_c69153687791fb52c12ce7cca2f4d03a65d9abf8.json │ ├── Albania_79b9d273ac6d2488109d1ea43e2bdb7977bd2b28.json │ ├── Algeria_bd6acc8626d118aea60331ce33bf000c9d7d1cee.json │ ├── American Samoa_ca0b36fec74bc61226adce2b5ce0e8ef6fdca179.json │ ├── Andorra_9d3bd1fb52785a7baeb03b437e7b2ecba54ef34f.json │ ├── Angola_a42522a0cdd6e41a1379e6c95d08a9c46a17249c.json │ ├── Anguilla_5722849f2ccb586368a07473e71e8df1bae7a221.json │ ├── Antarctica_00f33fc530d3e011ee6ab56f206622e221888971.json │ ├── Antigua and Barbuda_530670dca74039e859436ac4734296b861556efd.json │ ├── Argentina_354bf98925838ca68611b950e2a37ebd11c21640.json │ ├── Armenia_5f4599daa3415f788c1afc3db145f01b4bd2b438.json │ ├── Aruba_f3a826101b9a25f3573cb0f1a7505587de8c65c3.json │ ├── Australia_ceafb51e2b0783d53dd620019dff3aa66708a26f.json │ ├── Austria_593905b31972f6ffe58325abf98595caf4ebf458.json │ ├── Azerbaijan_213598a7e92217bee3a758f3c69aea09ed940c0e.json │ ├── Åland Islands_065154080d2f7539638e616e64cfcdb36c0577a1.json │ ├── Bahamas_1f797564f7843d36ebe5e841e5bd39c98157e22b.json │ ├── Bahrain_3ae11c725c30009d4d3418bc6b30789feed78322.json │ ├── Bangladesh_fa6c3752cd00f7f1277fd7e5604ab8d2edaf26b8.json │ ├── Barbados_93409af2f208e7545f0f26996e048113edd88652.json │ ├── Belarus_027a12c2fc8568e8b70b07ff536faf288a013670.json │ ├── Belgium_5cb4c9d828175ed3931ec52305b32f47173a8e04.json │ ├── Belize_42ab0c94a1e3bd6175a15dba215ccf5f10e861e5.json │ ├── Benin_373616e39fb47d9a1a4e87dfd4ea968037435f14.json │ ├── Bermuda_027ed37f00fb38adb089a91f2d52c7b931949168.json │ ├── Bhutan_bb2254a806f43df24753ca390143e2ca8c1e4e80.json │ ├── Bolivia_a001af75ee89582f31cb4db6d3dd0b4766c80050.json │ ├── Bonaire_fd71a444cd1566324317cbc5204af645857b5b72.json │ ├── Bosnia and Herzegovina_62ac59b7255ce5ff9fee8ac49157bdd9bc4445e2.json │ ├── Botswana_180c89bf50c8b29deb45e49d9dac62fcd5c8bedb.json │ ├── Bouvet Island_290125ef9fc28ca6df6137e0523169786f3ecfea.json │ ├── Brazil_37497aa5a2272c49714aee1b07e8edf973a95f59.json │ ├── British Indian Ocean Territory_9bb835f4f91b31fae3286529520eecae620d718c.json │ ├── British Virgin Islands_1fc1b5b29cefd14d32c7e252ca38633927f0c3ee.json │ ├── Brunei_130e4a34f1b807a8f3bd24b204c06ec4de4010da.json │ ├── Bulgaria_5c77726358c5daf98ad9cdccd0882bca0f718b88.json │ ├── Burkina Faso_e71b56d92347386fa76239ce33f67aaa2de52207.json │ ├── Burundi_4617585b8749a71bbb21237cab6c2dc9cbe3b86f.json │ ├── Cambodia_314ccd964ef6a8e68ac5f9bb89f751a1c2196c56.json │ ├── Cameroon_73a7ddd505f2fc2cead1522e54a794328f228c44.json │ ├── Canada_cd6a7b8768528485a0dbcd459185091e80dc28ad.json │ ├── Cape Verde_8e40809e474f3e0705ddef056618ce3e5043522a.json │ ├── Cayman Islands_e9e21c35ab345ef790305554368ebf78279482f2.json │ ├── Central African Republic_dba86789b53e54df0477a589a57298893cd87502.json │ ├── Chad_6c6b1b2b3ecc0e6900000dabf4faae6f8df5ffd1.json │ ├── Chile_349507e41dd8c71c10c9df6d2444b5e64a285691.json │ ├── China_d2eaf2aa1512d6596e0a5bae633537c6b8e779a3.json │ ├── Christmas Island_c6dfa97a611dbc45bfdc51c69a762488964e6361.json │ ├── Cocos (Keeling) Islands_d2dd2d43fef0a1aa180b01e58e8a9c32d7ac165a.json │ ├── Colombia_2f737399606486655401cb27b066f4658424766d.json │ ├── Comoros_e5bb59a2731998cae2070f6fd4f2e075fd61146f.json │ ├── Cook Islands_4bacfe2535ecbceb9a04a1b85c3a2e0bc53c64d6.json │ ├── Costa Rica_1bf429f94068620b112aca3888b58aecbc2eadee.json │ ├── Côte d'Ivoire_b2182992301690448db9754c5493729921c28056.json │ ├── Croatia_d7e0453bb4af87006533f4d77ad9546dac533db8.json │ ├── Cuba_c484b137e2d18229e4e7e677f1f8cfce6a0ab819.json │ ├── Curaçao_9461dd94ebb7643ea4fbbed9dc781497e05a6e7e.json │ ├── Cyprus_852addab901cbc5699d190285a009d7a7035fb57.json │ ├── Czech Republic_1fef42909247a6c230eeef66277f2b5e0e8f274e.json │ ├── Democratic Republic of the Congo_f39d28021812d3e91f4c64c9ac055a20d5bcfd30.json │ ├── Denmark_89da124e04dfe1ad9946cd37d91a119e1d028898.json │ ├── Djibouti_60a8b0c6de6f6abe5999959a5c7352750116fb9c.json │ ├── Dominica_bc1cd4f07d828493332f9c95c491d6fb338afd40.json │ ├── Dominican Republic_8a4bf12e17b2be590b12721ef8d5d0248698b5b6.json │ ├── Ecuador_09f199d25132204e99bfb1a89916de24494f19bb.json │ ├── Egypt_1c39abf68e93e438ae5dca946e2d6a986cccd3a9.json │ ├── El Salvador_259a6e935b848823a0c0b76aced2803060b4bd0c.json │ ├── Equatorial Guinea_80eaf3087b0b041473c6c223f1e09197b649362e.json │ ├── Eritrea_18740af5bcec9573bd3c059e0fc6570353097aab.json │ ├── Estonia_f0a96da3f86a334cbe8d569110d6545277973859.json │ ├── Ethiopia_3d91f7631ba813c13a08a208f1255b2e96fb03d0.json │ ├── Falkland Islands_11499959510cbab21e5241a8a6099a3d545b5227.json │ ├── Faroe Islands_1082f89115626b9c431f2176f832b3a7cc60fb2c.json │ ├── Fiji_bbb7ef7f2ec9557d0895c9da1c5cddd50d15049e.json │ ├── Finland_c909b138eba89ecfbd86df4c9d170ac78d4a3820.json │ ├── France_e3772ac4b4db87b4a8dbfa59ef43cd1a8ad29515.json │ ├── French Guiana_07090aa7d613105dad9bd80005cd91b8da1c4cb2.json │ ├── French Polynesia_40f39cdcd3acd771d31e4269e54caeff9b3b5edf.json │ ├── French Southern and Antarctic Lands_44e46ba30eabfe96165ac52eb27f1318dd7396e4.json │ ├── Gabon_a06dcd71328fd2b44fa7f84012096e8f318e4b48.json │ ├── Gambia_7c39974f44b2b12933c66a9eba3fe33c8d0805b6.json │ ├── Georgia_9113c6c0c1f9cb53e3543b53136ba30c51018373.json │ ├── Germany_17d53e0e6a68acdf80b78d4f9d868c8736db2cec.json │ ├── Ghana_317dbac90743c3e5e82b2ddf122cd076a2226a92.json │ ├── Gibraltar_e51335897c0ef4bb952693d4166902146a1bc812.json │ ├── Greece_4902a456caa9a4eab463ce526c9df0f6180be184.json │ ├── Greenland_1ba0cfa550295f8b2c5fa44b8236639adc825cf9.json │ ├── Grenada_dbf2a2da6458b242407285e7f1483aeb6cfee9fd.json │ ├── Guadeloupe_f0f524ff3b9cf7a30a94a59841b9c0d2fd858b56.json │ ├── Guam_f8aa3a934ee38a6c86d1b092624a9c385267d927.json │ ├── Guatemala_11760e1aac4396e10d315e93ad3df3e99204dc5e.json │ ├── Guernsey_180c97abdb80833b91cb32903dced0e8f8b49562.json │ ├── Guinea-Bissau_b07cb9a2b24832a8197cd3dfa67d1d6adfb0cfbb.json │ ├── Guinea_b47b54fd3a460f43ebbcabe5b10c189176f25f25.json │ ├── Guyana_bc88a24030a15bde613c8749ed93d30e0a81fcc2.json │ ├── Haiti_a4842f0234d7270b757b60b6f17a1b9f4d560dad.json │ ├── Heard Island and McDonald Islands_130447083d0bf6b6914b952751355ad34949129b.json │ ├── Honduras_5aa588714ab4cbfd615d238fd9778c3a14ca4ba8.json │ ├── Hong Kong_2f488ffc82ccc67a1616e39fdfc537297f1646c5.json │ ├── Hungary_f14e46ce7d094f9326167acc499698128651be85.json │ ├── Iceland_b3c92eecf0aa1905086059d9f6d3261d8fb19657.json │ ├── India_967ce367d89dccc133d71049f1197d29561b3726.json │ ├── Indonesia_35536a41b209715d9e3ad440431fef2672f20bbe.json │ ├── Iran_889224e3fca24a6ab17d01fe47a45bc82244e938.json │ ├── Iraq_1aed9ecc6e1be8eaaaddc5ffb6ba3ed84a8b1ae6.json │ ├── Ireland_eb2131ece0efe78ee8bb1ae98af6099114a8df09.json │ ├── Isle of Man_76733f338bb21fd91ee8304d05accb9163ee6e52.json │ ├── Israel_4c197dfd67f1ed79d11a8b0218cc368bfcce6ccb.json │ ├── Italy_ad79ef0f076d3a686ab9738925f4dd2c7e69d7d1.json │ ├── Jamaica_5eedd6a16ab862cb5d6b2e194e0bdf8b0161d89a.json │ ├── Japan_fcf29f6cad3232704b33e962ef5194fad3b6817b.json │ ├── Jersey_ff4636d0caf61d70e7dfa437d80aab75e921e76c.json │ ├── Jordan_674027e17b0ed64e76cde2005cb8e76fb4cd671a.json │ ├── Kazakhstan_2f36b6bb1852c24392fb3ee9a2879da24eb0750d.json │ ├── Kenya_a84f56f2e6a77ecb4b2f89344446dd3ff91b87c4.json │ ├── Kiribati_3f57adf2c06cecd095ff83ab72787889961bbe87.json │ ├── Kuwait_93295b0c76b900da760a8e0f2e9a29a1ba4b0f4c.json │ ├── Kyrgyzstan_c78791a3f0e109d34ba4eac2afa35ec011439ae3.json │ ├── Laos_7998be8d446d668c99abca446cb3bd79fce08d2b.json │ ├── Latvia_c5f5bb3b350774d7cda57104c55fb6c82b7ae7d9.json │ ├── Lebanon_5caa7f811b5aff6eb9993f309c4c045785ee67ec.json │ ├── Lesotho_93b12bf57f18c13c9ad2f55e33a8e3fd786fc394.json │ ├── Liberia_1ed5dd9d833f675b7509886681e2164d842f8dad.json │ ├── Libya_55949d4c16632f1c275d7684a379b8f1717b3904.json │ ├── Liechtenstein_b0ddce0f54c916c106117e280aead4f9c0cbf1df.json │ ├── Lithuania_74a788cee27d549015a0786732c662e05cdd7567.json │ ├── Luxembourg_5076721c4060feeb69bd2c3dd9bdce115d5c62f3.json │ ├── Macao_918c53a2d6129e9e4f42191b60fa11886bd9fa50.json │ ├── Macedonia_41349e9557e537855ae0f63cc43918fa13a561d3.json │ ├── Madagascar_f92bcb6a06d2ec7c0af7c8a338f131bf887c64a0.json │ ├── Malawi_0ce65b26dcd3c08e1b329d9efbb6bbbced426f31.json │ ├── Malaysia_ff3ea3bec182358766650a6fd2872d9221f7e6cc.json │ ├── Maldives_213cb204509284ff2aedeca9290b70a6da307eab.json │ ├── Mali_daa6a489dbca7a13c480aaa1d0c344957590fdb7.json │ ├── Malta_1a591a3e91fcb7a47f2c08e9e2e117f39af22078.json │ ├── Marshall Islands_bb130626b42c3cce860334424aef9a144f8231f2.json │ ├── Martinique_66f1a98a952d50fc3164cde58265772e2ab821c2.json │ ├── Mauritania_85fa355bdb4f46fa53a20a441623d53d686d4036.json │ ├── Mauritius_26160d23fb07cf8d5dae186eba322e9fc8e27bb4.json │ ├── Mayotte_dcc64425eed0e625072cc41ac60a88d4b3d50086.json │ ├── Mexico_41937b20fbe8c71d9c6c3346aff43c001aa25e33.json │ ├── Micronesia_5a7d7bc91620c2307f0ad338a4b7d7929bb8af8e.json │ ├── Moldova_9791bc4d7273587d61fef79841bd342381f5e321.json │ ├── Monaco_35ab1c3de6dac148401654e1ebf5dd935ccefa14.json │ ├── Mongolia_f54da380bade5d43098fd1f338cb8257523c508b.json │ ├── Montenegro_479fb34bdbf4aba90d03cca83f64ad4e912cc854.json │ ├── Montserrat_35f005157cfd133875b06f037eeeff3b7494456c.json │ ├── Morocco_32e087f099be121c1211285a1700ff83542193f7.json │ ├── Mozambique_a40a9be00a9ae956acd67011c0d96758916f40ea.json │ ├── Myanmar_928b7c48a60ad93b81bc3bee9d274c5f2aed9ad3.json │ ├── Namibia_bfe79debcedda1c1e11f7836c0fc13ad22dffca7.json │ ├── Nauru_f648c72a69c3a9b157c3603ebd4a75141a833e46.json │ ├── Nepal_0e1d589f58b71e2b7d5d8068156d160146820407.json │ ├── Netherlands_fb61c8a8eba24117016597fc7618f38821b16e8f.json │ ├── New Caledonia_b9967e88983d851428fa745aa72bb8b4e0bec2da.json │ ├── New Zealand_a2238e91907fa2436a6a50e0fd8cf97ab60ec508.json │ ├── Nicaragua_4812648c8a890c1818305642f6a01fa134b34401.json │ ├── Niger_6687e1896dd857dc1587782149127ff073a95696.json │ ├── Nigeria_9742d008c420ec9d44b1794c03b9701c477f93ff.json │ ├── Niue_c635e30148c3a013261cd3147f9ff8c70b2f9fea.json │ ├── Norfolk Island_fedb20736102194ca53af14fae03929409c27b9c.json │ ├── North Korea_765b46e79beff128df05b121d344cc7ad23dbac5.json │ ├── Northern Mariana Islands_28a117f173634e3c574231e0cfb011aabfd2bba8.json │ ├── Norway_988455e67df7cd81d090ea4bacdc05f39fb7caa5.json │ ├── Oman_c14c36dffca61b07410f5e3630ba5d99c60ab5d5.json │ ├── Pakistan_82d220df17cebf5ce4897d780c354dd5e925c209.json │ ├── Palau_e5e0b68adfacb66979505bedf6d424070c536eb6.json │ ├── Palestine_05a15c18a2038b35edcdb52e92f002c65d4fcf32.json │ ├── Panama_1e36b31e788231fba03577144de1d23b04a5d324.json │ ├── Papua New Guinea_fbaa3c3e9e1bbf9fe813f2d4c038b295ef046512.json │ ├── Paraguay_71a45296474d608f35d4b49f3b10384fc738e16f.json │ ├── Peru_36c57243155b80cf350c59764354b20dde157333.json │ ├── Philippines_8067364d44f5e37baba7e13ba124e934df410e2a.json │ ├── Pitcairn Islands_0311d743a395837f9490fa8a89013d4b047b366e.json │ ├── Poland_5ff03b7273b1808e5ba852e230991bbf07da703c.json │ ├── Portugal_a495190bcc2ef4116725616d321016a7def5bd8f.json │ ├── Puerto Rico_fe23c52dc2441843aa073092188089600dad336c.json │ ├── Qatar_83ef3e6cee83cb88a39814638a94fa1ad33e65a5.json │ ├── Republic of Kosovo_338e718d14c93382811119b87ed77b25aaed8a98.json │ ├── Republic of the Congo_b78ae043a4412720001cad4a83c176d09da0437f.json │ ├── Réunion_8e7e261a1ff0a9bbf184ec58b7db9d014d425e65.json │ ├── Romania_d6b897fd145a64fbad36ff7cb1c47a00dcbbe9b6.json │ ├── Russia_6754fe3cd8310d20ed04b8c7b66abebcdb16d88d.json │ ├── Rwanda_7266a1da7e3a6739b245ddfe74b0b682f7da63f8.json │ ├── Saint Barthélemy_f48e864508243ec01f6ac7ff781f13cd5bde0a0f.json │ ├── Saint Helena_03bdca149f934311777f23c15054c37a49e3289b.json │ ├── Saint Kitts and Nevis_3ad2dd829664a86f29aec0770e244c1717c79255.json │ ├── Saint Lucia_673b1cf863c8e2d10109731b098b19ba81aec9fb.json │ ├── Saint Martin_854ccc29cc22ef957d1e5ce961f30c1e92677d9c.json │ ├── Saint Pierre and Miquelon_70e53283edb6d53accd21aa7731dfe1f66246b84.json │ ├── Saint Vincent and the Grenadines_3fa9b2dd85d217dd4f6407fbb779928701f9e184.json │ ├── Samoa_f5680604ea9e0abbe3833339ee5a793c2c02551d.json │ ├── San Marino_87fd3befcce67042618f49ec496c2b09a49459fa.json │ ├── Saudi Arabia_6f49c31192f5681e1053a1d699956998c5d7e97d.json │ ├── São Tomé and Príncipe_655191a80835f37342e045bd71b73188430d3b39.json │ ├── Senegal_d8973b8edfe5e3211044e39d5452523b5d69cba9.json │ ├── Serbia_6d31bf00d7eddc6a617a6b16699f8ba91794e2fd.json │ ├── Seychelles_3d2d7b1c3400e9222f97a999decf652a6c34bdc5.json │ ├── Sierra Leone_50df2d658581499ea96e34b53f6280fd7754bd1f.json │ ├── Singapore_20c0b7bdab70ca2cc9c844a0d74a3af0bbf41c3e.json │ ├── Sint Maarten_ad7c3cc73f9cd1c049d3208aac984c49953b94b2.json │ ├── Slovakia_b6c149c3e00467fba347629a63ed02fed098d061.json │ ├── Slovenia_d1aa0503612aa4168939b77b59ca74532a11951a.json │ ├── Solomon Islands_ecae78abec522d0fa00ddb3666aa9db9baf0265f.json │ ├── Somalia_4dfdf195ecb76a3fa83788deca6fd3b289dd568f.json │ ├── South Africa_35fda17ff05f63e9061208c2dd2aaaf98790e921.json │ ├── South Georgia_618cd353b39276e0dd2215fabbbbb4d21803a69c.json │ ├── South Korea_04653e650280742f94a5a74ad6530ee09c2dc2be.json │ ├── South Sudan_6981f4026cf83935b630141d375a9455fc18acd7.json │ ├── Spain_20a8df9b760336178fca425339ec1c7e542a2463.json │ ├── Sri Lanka_197042c4de91dae8aeafa9a52dc8c3a59aa41dc0.json │ ├── Sudan_1193ba31f109ecfdfab76f13cc2b5e44479d5603.json │ ├── Suriname_b17fc6f05c078b63528a6d19c2abe0917e1e8a1b.json │ ├── Svalbard and Jan Mayen_ac99404d12d60aa0c46631720dd7afa750d0e909.json │ ├── Swaziland_c985df0809c3183c074ef84ac9e902d70ff81992.json │ ├── Sweden_72ddd2b619af6d6a73febf80f7fcad22495498cd.json │ ├── Switzerland_77dcd849e550afec3c83d38fcc8cbc72c058f4db.json │ ├── Syria_3ed104337eb1dfb750107978743cbf25fbe2c2b5.json │ ├── Taiwan_094d515b3608fefc6759a36412cee467437417a5.json │ ├── Tajikistan_279c771ae60c33fc34bde4627bb56ee8eecca33a.json │ ├── Tanzania_7e380be8dc28d72571144716e95e598c986bc4d6.json │ ├── Thailand_a2b7c120c93a01e67dcd4d984d2a781cde2c46df.json │ ├── Timor-Leste_2d79f6dbae283f57f4092d5370a518c3ef5caec1.json │ ├── Togo_30949d5f4a69766caa7abe5e6fd9993090b1b6b3.json │ ├── Tokelau_a08c1ca2fca39f1ea2de01c2de009926d07afb4d.json │ ├── Tonga_e8a1234b8442f09d8965e48d93a16e10fa398baa.json │ ├── Trinidad and Tobago_4d206a8103d3d20ac685314dbba1c88f6cfedd85.json │ ├── Tunisia_edf404d0db32652d41a29b428a804405e1d73a9e.json │ ├── Turkey_d7153e6702b4ea48c7c0d01affdef0e1b39fd6dc.json │ ├── Turkmenistan_1f8dc1a6076e90fb31efa48a19e2d220b647c81f.json │ ├── Turks and Caicos Islands_611bc125b7ad66ad9d5103c6bfd968a775763e6c.json │ ├── Tuvalu_9a2248f7c4de37c13c8e2688356857b589f669b4.json │ ├── Uganda_e92904bce8026b3c1f8828b0ce882e6b081c7fb6.json │ ├── Ukraine_c951ec00f123510a00d1e3d9539b11b4631d4096.json │ ├── United Arab Emirates_d115b8d5acb8386b8012aaf4cbb3812cacd97c8e.json │ ├── United Kingdom_9769121f10f77079b27eb08e9ffa488cbcc37ed0.json │ ├── United States Minor Outlying Islands_ede34a33eb69cc5980a8c2353752463771b7060e.json │ ├── United States Virgin Islands_65f5cb3322400cfd62ba3c8bcffbd7a8d71d0f32.json │ ├── United States_768685ca582abd0af2fbb57ca37752aa98c9372b.json │ ├── Uruguay_66b98924b384b40aea844bf0fe399d5d3832388e.json │ ├── Uzbekistan_db800e86e9f303e72e1102efb21d459512902d37.json │ ├── Vanuatu_d16ad2dcc6af8252a554ea5f1722abc518dfa3b1.json │ ├── Vatican City_136f5db5de74430b7c1e66fcd4ef0b6a70ace276.json │ ├── Venezuela_9d4ac43d5e24e3d01e448ce01a277ba5971e60f6.json │ ├── Vietnam_681101d8f9fa4e5e1fbe8ac5a2c05504c6c4875a.json │ ├── Wallis and Futuna_a187509aa2afa6ef9b1abbaed04d4bb5b6124ffb.json │ ├── Western Sahara_fab1a52391201253134c8cc0b956613cad675611.json │ ├── Yemen_ac33d641f4c9d9de5b29bb95e7f909066cfca512.json │ ├── Zambia_dcf25ed56c9566181e0f2d48d8854c04c4ca6b37.json │ ├── Zimbabwe_5922f5ceeff38bcfdb993efd6cfd5c472f827fa9.json │ └── generate.php ├── inconsistentdata │ ├── Denmark_89da124e04dfe1ad9946cd37d91a119e1d028898.json │ └── Djibouti_60a8b0c6de6f6abe5999959a5c7352750116fb9c.json ├── multidimensionalindex │ ├── Afghanistan_c69153687791fb52c12ce7cca2f4d03a65d9abf8.json │ ├── Albania_79b9d273ac6d2488109d1ea43e2bdb7977bd2b28.json │ └── Algeria_bd6acc8626d118aea60331ce33bf000c9d7d1cee.json ├── multidimensionalkey │ ├── Afghanistan_c69153687791fb52c12ce7cca2f4d03a65d9abf8.json │ ├── Albania_79b9d273ac6d2488109d1ea43e2bdb7977bd2b28.json │ └── Algeria_bd6acc8626d118aea60331ce33bf000c9d7d1cee.json └── querybyid │ ├── DJ.json │ ├── EE.json │ └── SE.json └── writable └── .gitkeep /.gitignore: -------------------------------------------------------------------------------- 1 | # Dependencies 2 | /vendor/ 3 | 4 | # Build 5 | /test-perf 6 | /build 7 | phpunit.xml 8 | 9 | # IDEs 10 | .idea 11 | .vscode 12 | -------------------------------------------------------------------------------- /.scrutinizer.yml: -------------------------------------------------------------------------------- 1 | checks: 2 | php: 3 | code_rating: true 4 | duplication: true 5 | tools: 6 | external_code_coverage: true 7 | filter: 8 | paths: [src/*] 9 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | jobs: 4 | include: 5 | - php: 7.3 6 | - php: 7.2 7 | - php: 7.1 8 | - php: 7.0 9 | - php: 5.6 10 | - php: 5.5 11 | dist: trusty 12 | - php: 5.4 13 | dist: trusty 14 | - php: 5.3.29 15 | dist: precise 16 | 17 | before_install: 18 | - if [[ ${TRAVIS_PHP_VERSION:0:3} < "7.1" ]]; then rm composer.lock; fi 19 | 20 | install: 21 | - composer install 22 | 23 | script: 24 | - vendor/bin/phpunit --coverage-clover=coverage.clover 25 | 26 | after_script: 27 | - wget https://scrutinizer-ci.com/ocular.phar 28 | - php ocular.phar code-coverage:upload --format=php-clover coverage.clover 29 | 30 | cache: 31 | directories: 32 | - $HOME/.composer/cache -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | Copyright © 2013 James Moss 3 | 4 | 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: 5 | 6 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 7 | 8 | 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. -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jamesmoss/flywheel", 3 | "description": "A lightweight, flat-file, document database", 4 | "keywords": ["flat", "file", "db", "document"], 5 | "homepage": "http://github.com/jamesmoss/flywheel", 6 | "license": "MIT", 7 | "authors": [ 8 | { 9 | "name": "James Moss", 10 | "email": "james@moss.io", 11 | "homepage": "http://moss.io" 12 | } 13 | ], 14 | "require": { 15 | "php": ">=5.3.2" 16 | }, 17 | "require-dev": { 18 | "mikey179/vfsstream": "^1.6", 19 | "mockery/mockery": "1.* || 0.*", 20 | "mustangostang/spyc": "dev-master#eba310c", 21 | "phpunit/phpunit": "7.* || 4.*" 22 | }, 23 | "suggest": { 24 | "mustangostang/spyc": "You must install this if you're using the YAML or Markdown formatters." 25 | }, 26 | "autoload": { 27 | "psr-0": { 28 | "JamesMoss\\Flywheel\\": ["src/", "test/"] 29 | } 30 | }, 31 | "config": { 32 | "sort-packages": true 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /phpunit.xml.dist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | test/ 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | ./src 14 | 15 | 16 | 20 | -------------------------------------------------------------------------------- /src/JamesMoss/Flywheel/DocumentInterface.php: -------------------------------------------------------------------------------- 1 | contentFieldName = $contentFieldName; 12 | } 13 | 14 | public function getFileExtension() 15 | { 16 | return 'md'; 17 | } 18 | 19 | public function encode(array $data) 20 | { 21 | $body = isset($data[$this->contentFieldName]) ? $data[$this->contentFieldName] : ''; 22 | unset($data[$this->contentFieldName]); 23 | 24 | $str = "---\n"; 25 | $str.= parent::encode($data); 26 | $str.= "---\n"; 27 | $str.= $body; 28 | 29 | return $str; 30 | } 31 | 32 | public function decode($data) 33 | { 34 | $parts = preg_split('/[\n]*[-]{3}[\n]/', $data, 3); 35 | 36 | $yaml = parent::decode($parts[1]); 37 | $yaml[$this->contentFieldName] = $parts[2]; 38 | 39 | return $yaml; 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /src/JamesMoss/Flywheel/Formatter/YAML.php: -------------------------------------------------------------------------------- 1 | markTestSkipped( 13 | 'The APC extension is not enabled on the command line. Set apc.enable_cli=1.' 14 | ); 15 | } 16 | 17 | $path = __DIR__ . '/fixtures/datastore/querytest'; 18 | $config = new Config($path . '/'); 19 | $repo = new Repository('countries', $config); 20 | $query = new CachedQuery($repo); 21 | 22 | $total = 0; 23 | 24 | for ($i = 0; $i < 100; $i++) { 25 | $start = microtime(true); 26 | $query->where('cca2', '==', 'GB'); 27 | $query->execute(); 28 | $total += microtime(true) - $start; 29 | } 30 | 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /test/JamesMoss/Flywheel/DocumentTest.php: -------------------------------------------------------------------------------- 1 | 'snow', 13 | )); 14 | 15 | $doc->setId('albums'); 16 | $this->assertEquals('albums', $doc->getId()); 17 | } 18 | 19 | public function testGettingInitialId() 20 | { 21 | $doc = new Document(array( 22 | 'mike' => 'snow', 23 | )); 24 | 25 | $doc->setId('albums'); 26 | $this->assertEquals('albums', $doc->getInitialId()); 27 | 28 | $doc->setId('singles'); 29 | $this->assertEquals('albums', $doc->getInitialId()); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /test/JamesMoss/Flywheel/Formatter/JSONTest.php: -------------------------------------------------------------------------------- 1 | assertSame('json', $formatter->getFileExtension()); 13 | } 14 | 15 | public function testEncoding() 16 | { 17 | $formatter = new JSON; 18 | $data = array( 19 | 'name' => 'Joe', 20 | 'age' => 21, 21 | 'employed' => true, 22 | ); 23 | 24 | $options = defined('JSON_PRETTY_PRINT') ? JSON_PRETTY_PRINT : null; 25 | 26 | $this->assertSame(json_encode($data, $options), $formatter->encode($data)); 27 | } 28 | 29 | public function testDecoding() 30 | { 31 | $formatter = new JSON; 32 | $data = (object)array( 33 | 'name' => 'Joe', 34 | 'age' => 21, 35 | 'employed' => true, 36 | ); 37 | $raw = '{"name":"Joe","age":21,"employed":true}'; 38 | 39 | $this->assertEquals($data, $formatter->decode($raw)); 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /test/JamesMoss/Flywheel/Formatter/YAMLTest.php: -------------------------------------------------------------------------------- 1 | assertSame('yaml', $formatter->getFileExtension()); 13 | } 14 | 15 | public function testEncoding() 16 | { 17 | $formatter = new YAML; 18 | $data = array( 19 | 'name' => 'Joe', 20 | 'age' => 21, 21 | 'employed' => true, 22 | ); 23 | $content = $this->normalizeLineendings(file_get_contents(__DIR__ . '/fixtures/joe.yaml')); 24 | $this->assertSame($content, $formatter->encode($data)); 25 | } 26 | 27 | public function testDecoding() 28 | { 29 | $formatter = new YAML; 30 | $data = array( 31 | 'name' => 'Joe', 32 | 'age' => 21, 33 | 'employed' => true, 34 | ); 35 | $raw = file_get_contents(__DIR__ . '/fixtures/joe.yaml'); 36 | 37 | $this->assertEquals($data, $formatter->decode($raw)); 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /test/JamesMoss/Flywheel/Formatter/fixtures/joe.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Joe 3 | age: 21 4 | employed: true 5 | --- 6 | Lorem ipsum dolor 7 | sit amet -------------------------------------------------------------------------------- /test/JamesMoss/Flywheel/Formatter/fixtures/joe.yaml: -------------------------------------------------------------------------------- 1 | name: Joe 2 | age: 21 3 | employed: true 4 | -------------------------------------------------------------------------------- /test/JamesMoss/Flywheel/TestBase.php: -------------------------------------------------------------------------------- 1 |